conversion problem

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2007
Posts: 9
Reputation: pritia is an unknown quantity at this point 
Solved Threads: 0
pritia pritia is offline Offline
Newbie Poster

conversion problem

 
0
  #1
Dec 7th, 2007
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)
Reply With Quote Quick reply to this message  
Join Date: Dec 2003
Posts: 2,414
Reputation: alc6379 has a spectacular aura about alc6379 has a spectacular aura about alc6379 has a spectacular aura about 
Solved Threads: 123
Team Colleague
alc6379's Avatar
alc6379 alc6379 is offline Offline
Cookie... That's it

Re: conversion problem

 
0
  #2
Dec 7th, 2007
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.
Alex Cavnar, aka alc6379
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 370
Reputation: greeny_1984 is an unknown quantity at this point 
Solved Threads: 29
greeny_1984's Avatar
greeny_1984 greeny_1984 is offline Offline
Posting Whiz

Re: conversion problem

 
0
  #3
Dec 11th, 2007
hii,
since u are using asp.net with vb.try using '&' instead of '+' in the sql query.
hope it helps
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,080
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Solved Threads: 68
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: conversion problem

 
0
  #4
Dec 11th, 2007
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 "+"
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC