Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 add new row

Author  Topic 

q8z
Starting Member

3 Posts

Posted - 2005-06-22 : 04:42:49
this sql not work:
private void addUser( )
{
try
{
this.openConnection();
OleDbConnection Conn = new OleDbConnection();
Conn.ConnectionString = this.con.ToString();
string strAdd = "insert into tbl_users (password,userName,name,mail) values (@password,@userName,@name,@mail)";
OleDbCommand cmd = new OleDbCommand();
cmd.Parameters.Add("@password", OleDbType.VarWChar, 50, this.TxtPassword.Text);
cmd.Parameters.Add("@userName", OleDbType.VarWChar, 50, TxtUserName.Text);
cmd.Parameters.Add("@name", OleDbType.VarWChar, 50, TxtName.Text);
cmd.Parameters.Add("@mail", OleDbType.VarWChar, 50, TxtMail.Text);
cmd.CommandText = strAdd;
cmd.Connection = Conn;
cmd.ExecuteNonQuery();
}
catch (Exception ex)
{
LblError.Text=ex.ToString();
}
finally
{
this.closeConnection( );
}
}

i get this error:
System.ArgumentException: Format of the initialization
string does not conform to the OLE DB specification.
Starting around char[0] in the connection string. at
System.Data.OleDb.OleDbConnection.ParseConnectionString(String&
value, Boolean checkForUDL) at
System.Data.OleDb.OleDbConnection.set_ConnectionString(String
value) at Idea.regist.addUser() in
c:\inetpub\wwwroot\idea\regist.aspx.cs:line 89

thanks

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-06-22 : 11:04:44
Since the error indicates a problem with the connect string, it might be helpful to check that and/or show us the one you are using.

- Jeff
Go to Top of Page
   

- Advertisement -