Hi,
thanks for your reply. I now found the reason but not the solution.
In the submit webmethod of the webservice, I only updated the sqldataadapter but did not run any insert code for sql.
The sqldataadapter already created the insert command by itself when adding the sqldataadapter to the webservice.
But when I try to submit the data, i get the failure message :
System.Data.SqlClient.SqlException: The parameterized query '(@Firstname nchar(4000),@Lastname nchar(4000))INSERT INTO [timet' expects the parameter '@Firstname', which was not supplied.
Here is the WebMethod to submit to the database and the SqlInsertCommand.
[WebMethod] // A method to expose on the Web service
public DataSet SubmitDataSet(DataSet ds)
{
InitializeComponent();
sqlConnection1.Open();
sqlInsertCommand1.ExecuteNonQuery();
sqlConnection1.Close();
return ds;
}
// sqlInsertCommand1
this.sqlInsertCommand1.CommandText = "INSERT INTO [timetrack] ([Firstname], [Lastname]) VALUES (@Firstname, @Lastname)";
this.sqlInsertCommand1.Connection = this.sqlConnection1;
this.sqlInsertCommand1.Parameters.AddRange(new System.Data.SqlClient.SqlParameter[] {
new System.Data.SqlClient.SqlParameter("@Firstname", System.Data.SqlDbType.NChar, 0, "Firstname"),
new System.Data.SqlClient.SqlParameter("@Lastname", System.Data.SqlDbType.NChar, 0, "Lastname")});
//
Can you see, where the failure is hidden??
The web-form of Infopath has only two text-boxes to type in a firstname and a lastname...
Should be a simple webservice but is already a 2 weeks project now. Would be great if you can help me find a solution.