Sorry for asking stupid question as I am newbie to C#.
Currently doing a task in c# using OLEDB. The scenario is, I want to insert in one table which has information like username, pasword, etc. The Database is SQL Server. The column Pasword has a datatype varbinary(100).
I want to convet from string datatype to SQL's varbinary equivalent datatype. I tried a little bit, but didn't succeed.
Initially I just tried with reader.GetString(5)
. But exception I got is :
"Specified cast is not valid."
* I forgot to mentioned below things *
Reader I used is OleDbDataReader.
oleParameter[7] = new OleDbParameter("@Password", OleDbType.VarBinary, 100);
oleParameter[7].Value = reader1.GetBytes(5);
(Here I am reading from one table and inserting into another table.)
Please help me.
Thanks.