i need some help here
i have design a gridview which contains two columns with dropdown list first is emp_id column n second is orderofwork column...when i try to update database with selected values in dropdown it gives me the following error

Conversion from string "update subj_emp_assign set emp_i" to type 'Double' is not valid.

in database emp_id is varchar n orderofwork is int

Dim newEmpId As String
Dim workorder As Integer
newEmpId = CType(gvwJobDetails.Rows(e.RowIndex).Cells(2).Controls(1), DropDownList).SelectedItem.Text
workorder = CInt(CType(gvwJobDetails.Rows(e.RowIndex).Cells(4).Controls(1), DropDownList).SelectedItem.Text)


sqlcmd = New SqlCommand("update subj_emp_assign set emp_id='" + newEmpId.Trim() + "',order_of_work=" + Integer.Parse(workorder) + " where subj_id='" + subjId.Trim() "' ", sqlConn)

Recommended Answers

All 3 Replies

if you run a debugger on your code, what does the actual sqlcmd's CommandText look like when you run the code? That might give us a clue on what's happening.

hii,
since u are using asp.net with vb.try using '&' instead of '+' in the sql query.
hope it helps

You need to change your database column from Integer to BigInt. There is not enough room and you probably surpassed the limit of Integer.

And yes, with VB.net you should use "&" instead of "+"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.