I am trying to insert customer details into a database. The following is the code that is throwing argument expression
- how can I handle it?
Try {string constring = "DataSource =. \\ SQLEXPRESS;" + "Integrated security = true;" + "User instance = true;" + "Attach DBFileName | DataDirectory | Database1 SDF;" + "Initial Catalog = Database1"; (Using SqlConnection connection = new SqlConnection (constring)) {connection.Open (); Include in SqlCommand cins = New SqlCommand ("Customer (CID, CNN, MOBI)" VALUES (@ cid, @ cname, @mobi) ", connection); Cins.Parameters.AddWithValue (" @ cid ", text box 3. Text); Cins.Parameters.AddWithValue ("@ cname", ncustname.Text); Cins.Parameters.AddWithValue ("@mobi", ncustmno.Text); cins.ExecuteNonQuery (); MessageBox.Show ("New customer added "); Ncustpn.Hide (); Class1.refreshcustomertable (cdgv); cdgv.Show ();}} Hold (Exception E1) {Message Box. Show (e1.ToString ());}
string constring = "data-source =.">
\\ SQLEXPRESS; "+" Integrated Security = True; "+" User Instance = True; "+" Attach DBF filename = | Data directory Database 1 SDF; "+" Initial List = Database 1 ";
This is not a datasource , a location in between data source
string constring = "data source =. \\ SQLEXPRESS; "+" Integrated Security = True; "+" User Instance = True; "+" Attach DBFLMNY | Data directory Database 1 SDF; "+" Initial Catalog = Database 1 ";
No comments:
Post a Comment