I'm having trouble dealing with type conversions...
CODE:
public static string isLocalIncidentSubmitted()
{
string query = "SELECT Submit From [MVCOmar].[dbo].PrideMVCSubmitLog WHERE ReportID=@existingNum";
DataTable dt = new DataTable();
SqlConnection connection = new SqlConnection(connectionStr4);
SqlCommand command = new SqlCommand(query, connection);
command.Parameters.AddWithValue("@existingNum", MyGlobals1.secondversionDisplayTesting);
connection.Open();
SqlDataAdapter adp = new SqlDataAdapter(command);
adp.Fill(dt);
connection.Close();
command.Dispose();
connection.Dispose();
return dt.Rows[0]["Submit"].ToString();
}
the table submit is of type varchar
I get a large error but here are first few lines of it:
System.Data.SqlClient.SqlException: Conversion failed when converting from a character string to uniqueidentifier. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.HasMoreRows()