sql query in c#, Invalid object name 'userInfo'

bills4

New Member
\[code\]SqlConnection scon = new SqlConnection(arthurDBConnectionString);SqlDataAdapter da = new SqlDataAdapter();da.InsertCommand = new SqlCommand("INSERT INTO userInfo VALUES(@firstname, @lastname)", scon);da.InsertCommand.Parameters.Add("@firstname", SqlDbType.VarChar).Value = http://stackoverflow.com/questions/15911503/firstname;da.InsertCommand.Parameters.Add("@lastname", SqlDbType.VarChar).Value = http://stackoverflow.com/questions/15911503/lastname;scon.Open();da.InsertCommand.ExecuteNonQuery(); <--Exception(Invalid object name)scon.Close();\[/code\]First off I would like to say that I am new to SQL. I am working on an application in C# that will manipulate data on a SQL Server. Above is the code I have for adding data to two columns of a table but I get the error that 'userInfo' (the table) is an invalid object name. I have made sure that this table exists in the database and that the connection is Open. I have also tried referring to the table as\[code\]DATABASENAME.SCHEMA.userInfo\[/code\] and \[code\]SCHEMA.userInfo\[/code\] with the same results. Thanks in advance for any help or input.
 
Top