I've filled a dataset with data from one database. I am now trying to populate it into another database, different table BUT same schema.
thing is everytime I try to executenonquery I always get an error:
Prepared statement '(@p1 int,@p2 datetime,@p3 nvarchar(1024))INSERT INTO Table3 (ID,' expects parameter @p1, which was not supplied.
but I did though....
what am I doing wrong?Code:this.theSQLDataAdapter.InsertCommand = new SqlCommand("INSERT INTO Table3 (ID, dateOfEntry, theNews) VALUES (@p1, @p2, @p3)"); this.theSQLDataAdapter.InsertCommand.Connection = new SqlConnection("Server=.;database=test;Trusted_Connection=true;"); SqlParameter p1 = new SqlParameter("@p1", SqlDbType.Int); p1.SourceColumn = "ID"; SqlParameter p2 = new SqlParameter("@p2", SqlDbType.DateTime); p2.SourceColumn = "dateOfEntry"; SqlParameter p3 = new SqlParameter("@p3", SqlDbType.NVarChar, 1024); p3.SourceColumn = "theNews"; this.theSQLDataAdapter.InsertCommand.Parameters.Add(p1); this.theSQLDataAdapter.InsertCommand.Parameters.Add(p2); this.theSQLDataAdapter.InsertCommand.Parameters.Add(p3); this.theSQLDataAdapter.InsertCommand.Connection.Open(); this.theSQLDataAdapter.InsertCommand.ExecuteNonQuery(); this.theSQLDataAdapter.InsertCommand.Connection.Close();





any chance of a regain? 
Reply With Quote