Dataset error

Solved/Closed
ashok - Mar 3, 2010 at 05:12 AM
Ambucias Posts 47356 Registration date Monday February 1, 2010 Status Moderator Last seen February 15, 2023 - Sep 28, 2010 at 04:22 PM
Hello,
sir .....
SqlConnection con = new SqlConnection(@"Server=ASHOK\MYSQLSERVER;Database=sample;Trusted_Connectopn=True");
SqlCommand cmd = new SqlCommand("insert into emp values("+this.TextBox1 .Text+",'"+this.TextBox2.Text+"',"+this.TextBox3 .Text +")",con);
con.Open();
DataSet ds = new DataSet(cmd,con);
SqlDataAdapter da = new SqlDataAdapter();
da.Fill(ds);
con.Close();
the error message is:Error 1 The best overloaded method match for 'System.Data.DataSet.DataSet(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)' has some invalid arguments C:\ashok\SampleApp1\SampleApp1\WebForm2.aspx.cs 26 26 SampleApp1
Error 2 Argument '1': cannot convert from 'System.Data.SqlClient.SqlCommand' to 'System.Runtime.Serialization.SerializationInfo' C:\ashok\SampleApp1\SampleApp1\WebForm2.aspx.cs 26 38 SampleApp1
Error 3 Argument '2': cannot convert from 'System.Data.SqlClient.SqlConnection' to 'System.Runtime.Serialization.StreamingContext' C:\ashok\SampleApp1\SampleApp1\WebForm2.aspx.cs 26 42 SampleApp1
The above three error I cant find the error please help me sir .........................
Related:

3 responses

SqlConnection con = new SqlConnection(@"Server=ASHOK\MYSQLSERVER;Database=sample;Trusted_Connectopn=True");
SqlCommand cmd = new SqlCommand("insert into emp values("+this.TextBox1 .Text+",'"+this.TextBox2.Text+"',"+this.TextBox3 .Text +")",con);
con.Open();
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(ds);
con.Close();
1
SqlConnection con = new SqlConnection(@"Server=ASHOK\MYSQLSERVER;Database=sample;Trusted_Connectopn=True");
SqlCommand cmd = new SqlCommand("insert into emp values("+this.TextBox1 .Text+",'"+this.TextBox2.Text+"',"+this.TextBox3 .Text +")",con);
con.Open();
DataSet ds = new DataSet(); //check it out
SqlDataAdapter da = new SqlDataAdapter(cmd); // check it out too
da.Fill(ds);
con.Close();
1
i hope this would be solve your trouble..have a nice time
0
Ambucias Posts 47356 Registration date Monday February 1, 2010 Status Moderator Last seen February 15, 2023 11,167
Sep 28, 2010 at 04:22 PM
Hello Abdul,

You have posted your solution twice. I guess that you were waining for a reply from the person who posted the question.

Have you noticed that the initial question was posted on March 3, 2010? That is the reason why you did not receive a thank you note.

However, I will thank you for your contribution. I will also have the thread marked as solved. It will remain on the forum for years to come.

If there further questions or gratitude marks, you will receive them here and through your e-mail.

Thank you again for helping

My very best regards
0