When I use the first item in a zero-based Enum cast to Int32 as a query parameter, the parameter value is null. I've worked around it by simply setting the first item to a value of 1, but I was wondering though what's really going on here? This one has me scratching my head. Why is the parameter value regarded as null, instead of 0?
Enu...
Is there a way to set a SqlParameter's value with DataGridView, if data-bound?
For example:
SqlCommand selCmd = CreateCommand("SELECT * FROM table1");
SqlCommand updCmd = CreateCommand("UPDATE table1 Set column1 = @column1 WHERE id = @id");
updCmd.Parameters.Add(new SqlParameter("column1"), SqlDbTypes.Int));
updCmd.Parameters.Add(new ...
I have a SqlCommand which runs a stored procedure that contains two integer output parameters. Right before the SqlCommand runs I can see that the output parameters are set to the correct values, however when the command actually executes, it uses a NULL for parameter1 and 0 for parameter2 (verified using SQL Profiler) regardless of what...
I have a SQL Server database, and I want to store in image type column some string.
I'm trying to do the following :
SqlParameter myparam = new SqlParameter("@myparam", "VeryLongString");
myparam.SqlDbType = SqlDbType.Image;
when I add it to the command and then execute it, I get the following error :
Failed to convert paramete...