Friday, July 8, 2011

How to insert complete dataset values into sql server 2005+ using XML

First we have to convert the ds into xml and pass it to the stored

procedure.
For the sake of simplicity i created here a xml schema @xml-schema and temporary table #TempTable.


DECLARE @ixml int
DECLARE @xml-schema varchar(max)
SET @xml-schema ='





'

--Create an internal representation of the XML document.
EXEC sp_xml_preparedocument @ixml OUTPUT, @xml-schema
-- Execute a SELECT statement that uses the OPENXML rowset provider.


SELECT *
Into #TempTable
FROM OPENXML(@ixml, '/ROOT/Trans',1)
WITH
(
TransId varchar(10),
[Add] bit,
Edit bit,
[Delete] bit,
[View] bit,
Block bit
)

Select * From #TempTable

drop table #TempTable




You can change it as per your requirement . have any query please contact me rahularyansharma@gmail.com

Friday, September 3, 2010

how to create ms acess database at runtime for seprate finance year




using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ADOX; (for this u have to add refrence)





private void button1_Click(object sender, EventArgs e)
{
try
{
CatalogClass cat = new CatalogClass();
string tmpStr;
string filename = txtStartingYear.Text + "-" + txtEndingYear.Text;
tmpStr = "Provider=Microsoft.Jet.OLEDB.4.0;";
tmpStr += "Data Source= C:\\" + filename+".mdb" + ";Jet OLEDB:Engine Type=5";
cat.Create(tmpStr);
Table nTable = new Table();
nTable.Name = "PersonData";
nTable.Columns.Append("LastName", DataTypeEnum.adVarWChar, 25);
nTable.Columns.Append("FirstName", DataTypeEnum.adVarWChar, 25);
nTable.Columns.Append("Address 1", DataTypeEnum.adVarWChar, 45);
nTable.Columns.Append("Address 2", DataTypeEnum.adVarWChar, 45);
nTable.Columns.Append("City", DataTypeEnum.adVarWChar, 25);
nTable.Columns.Append("State", DataTypeEnum.adVarWChar, 2);
nTable.Columns.Append("Zip", DataTypeEnum.adVarWChar, 9);
cat.Tables.Append(nTable);
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(nTable);
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(cat.Tables);
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(cat.ActiveConnection);
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(cat);
}
catch (Exception ex)
{
MessageBox.Show("Database with this name already exists");
}
}

Saturday, August 21, 2010

when executing a sql file getting "system.outofmemoryexception" in sql server 2005

hi dears
today i m face a very interesting problem is that in our erp system we gnerate .sql file from database publishing wizard and server genrate .sql file successfully . but when i am execute that file on our local system in sql server 2005 we will get error that "system.outofmemoryexception" .i google it and found the solution that this problem is related to sql server memory configuration
. actually default setting of sql server use 2 gb memory for executing the any query in database sql server 2005
then there is two option
1-first one is suggested by msdn is that expand your memory from 2gb to 3 gb

2- second which i try and got success which is dont execute query at once , divide ur query in bunch of some lines so you can execute them.and after one by one execute all bunch of sql queries

i know that my solution is temporary but its work for me..

Friday, August 20, 2010

how to Show HTML/JavaScript Code inside Blogger Blog Posts on your blog

as you read different posts on my blog you see that there are many post in which there should be some code but its not show . why is there is a reason behind this which is in detail show below

"The Blogspot’s XML parser takes it as a code, and shows the result whatever is written in the code you pasted… Its only you who knows that you wanted to show the code deliberately without wanting it to be parsed automatically ."



so now as always solution in problem it self . so in this our problem the solution is that our code should not be parsed automatically for this ...........



Google’s Blogger Team realized this, and have added a solution for this in Blogger’s settings.

1. Login to your blogger account
2. Go to Settings.
3. Go down to the page.
4. Under “Select Post Editor”, choose “Updated Editor”.
5. Save the Settings.

after this setting for a new post which have code use following

Now Go and make a post, click “Post Options” below the post editor, and select “show HTML Literally”.

Insert any HTML codes in the post and preview or publish it.

how to Change the Authentication Mode of the SQL server 2005 from "Windows Authentication Mode (Windows Authentication)" to "Mixed Mode (Windows Au

hi to all ,

today i face a problem that is at the time of installation of slq server 2005 i have choosen window authentication except

Mixed Mode (Windows Authentication and SQL Server Authentication)", and now i want to change it because when i create any new

login and try to connect with the new login credentials it will show error that "user is not associated with trusted sql

server connection" and this error due to i have choosen window authentication . so i have to change this mode in sql server.
for this it is simple connect ur server with window aunthetication and right click on server name in object explorer and

choose properties -> a window will open and in side pane choose security page there is a option to change mode , now press ok
now u can login with sql server authentication mode.

Wednesday, August 18, 2010

how to set default browser ?

today i face a problem , actually when i am login in gtalk and want to click on mail button in my gtalk it will open my gmail

account in internet explorer , but i want that it should open in mozilla firefox, the problem is understandable that mozilla

is currently not my default browser ? then i how can set it default browser ?
i google on this topic and find solution on mozilla website that you can go throught tools menu and choos options and in

option dialog box choose advanced tab there is a subtab general at first no my there is option to check default browser and

if u press it then it will ask to set mozilla set as default so u can make mozilla firefox as default browser from here .


but the problem is still that if i want to set any other browser so i need a solution from which i can set any browser as

default browser.
and problem solution exists in window settings that is sure. and finally i got the solution that is go to your control

panel and in add or remove programs there is a option for "set program access and defualts" in side bar of dialog box where u can find the set the default for any program u want . there u can set any browser as your default browser......

Monday, August 16, 2010

keyboard with new rupees sign

hi dear
after launching new rupee sign by govt. of india the keyboard which have new rupee sign is launched , the details information is avaliable on below link

http://www.techtree.com/India/News/First_Keyboard_with_the_New_Rupee_Sign_Arrives/551-112580-581.html

ASP.NET Core

 Certainly! Here are 10 advanced .NET Core interview questions covering various topics: 1. **ASP.NET Core Middleware Pipeline**: Explain the...