amitrajan
11-17-2004, 05:38 PM
Hi again
iam trying to insert values in a table .
if i use the litereal values it goes thru :
'comm.CommandText = "INSERT INTO sch_employee(se_id,se_name,se_surname,se_hash,se_salt,se_email,sd_id,se_manager,se_newEmp) VALUES ('zara.veer','zara','veer','99496AF5679E9D42BC16EFE5C532B978CFBCC7E2','FUSz3Vk=','raj@india.com','1','0','1')"
but now i want to replace the litereral values with variables something like that:
comm.CommandText = "INSERT INTO sch_employee(se_id, se_name,se_surname ,se_hash ,se_salt ,se_email ,sd_id ,se_manager ,se_newEmp) VALUES " + "('" + s_se_id + "', " + _
"'" + s_se_name + "', " + _
"'" + s_se_surname + "', " + _
"'" + s_se_hash + "', " + _
"'" + s_se_salt + "', " + _
"'" + s_se_email + "', " + _
"'" + s_sd_id + "', " + _
"'" + s_se_manager + "', " + _
"'" + s_se_newEmp + "'" + _
")"
all the variables have a value other then Null and/or zero and have been type casted if required.
this is the exeption i keep getting. :cry:
Exception Details: System.FormatException: Input string was not in a correct format.
[InvalidCastException: Cast from string "INSERT INTO sch_employee(se_id, " to type 'Double' is not valid.]
None of the Datatypes of fields in the table are Doulble and i have already done the type casting wherever needed.
Again thanks in advance for reading the horrible code but any help would be greatly appreciated.
ps: i have also tried using the Parameters but no luck :no:
With comm.Parameters
' .Add("@id", SqlDbType.VarChar, 20).Value = "zzz.zzz"
-
-
-
-
'End With
iam trying to insert values in a table .
if i use the litereal values it goes thru :
'comm.CommandText = "INSERT INTO sch_employee(se_id,se_name,se_surname,se_hash,se_salt,se_email,sd_id,se_manager,se_newEmp) VALUES ('zara.veer','zara','veer','99496AF5679E9D42BC16EFE5C532B978CFBCC7E2','FUSz3Vk=','raj@india.com','1','0','1')"
but now i want to replace the litereral values with variables something like that:
comm.CommandText = "INSERT INTO sch_employee(se_id, se_name,se_surname ,se_hash ,se_salt ,se_email ,sd_id ,se_manager ,se_newEmp) VALUES " + "('" + s_se_id + "', " + _
"'" + s_se_name + "', " + _
"'" + s_se_surname + "', " + _
"'" + s_se_hash + "', " + _
"'" + s_se_salt + "', " + _
"'" + s_se_email + "', " + _
"'" + s_sd_id + "', " + _
"'" + s_se_manager + "', " + _
"'" + s_se_newEmp + "'" + _
")"
all the variables have a value other then Null and/or zero and have been type casted if required.
this is the exeption i keep getting. :cry:
Exception Details: System.FormatException: Input string was not in a correct format.
[InvalidCastException: Cast from string "INSERT INTO sch_employee(se_id, " to type 'Double' is not valid.]
None of the Datatypes of fields in the table are Doulble and i have already done the type casting wherever needed.
Again thanks in advance for reading the horrible code but any help would be greatly appreciated.
ps: i have also tried using the Parameters but no luck :no:
With comm.Parameters
' .Add("@id", SqlDbType.VarChar, 20).Value = "zzz.zzz"
-
-
-
-
'End With