I am trying the new feature in SQL Server 2008 where you can pass in a DataTable to a stored procedure.I am using the SQLHelper class to pass the datatable formed to the DataBase.Here's the example:SqlParameter
parameter= newSqlParameter("@TabModuleColumnSetting",SqlDbType.Structured);parameter.Value = tabModuleColumnSetting;SqlHelper.ExecuteNonQuery(this.ConnectionString,"SP_Name",parameter);I Face the following issue in the above line:"The
incoming tabular data stream (TDS) remote procedure call (RPC) protocol stream is incorrect.Table-valued parameter 6 (\"@TabModuleColumnSetting\"), row 0, column 0: Data type 0xF3 (user-defined table type)has a non-zero length database name specified. Database name is not allowed with a table-valued parameter,only schema name and type name are valid."}
I have got the solution to the above problem:
1.
SqlConnection sqlConn =newSqlConnection(ConnectionString); sqlConn.Open(); SqlCommand sqlCmd = sqlConn.CreateCommand(); sqlCmd.CommandText = spLoad;// sqlCmd.CommandType = CommandType.StoredProcedure; SqlParameter[] parameters = newSqlParameter[1]; parameters[0] = new SqlParameter("@LoadSPParam", SqlDbType.Structured); parameters[0].Value = loadSPParams; sqlCmd.Parameters.Add(parameters[0]); sqlCmd.ExecuteNonQuery();2.SqlParameter parameter=newSqlParameter("@TabModuleColumnSetting",SqlDbType.Structured);parameter.Value = tabModuleColumnSetting;SqlHelper.ExecuteNonQuery(this.ConnectionString,CommandType.StoredProcedure"SP_Name",parameter);But I am not sure about the exact reason why this happens. It will be great if somebody can explain me the exact reason for the above error and how is that solved with the above solutions.Thanx in Advance.