Ok, My code was work all fine and dandy when we used customer number that were numerical in value. We moved some customers from another office into our database, and the customer number are alpha characters...
Now every time I run this code I get "The conversion of the nvarchar value ' 4000545398' overflowed an int column. Maximum integer value exceeded."
Code as follows...
My error comes at 'While readerObj2.Read'.
When I set around it in debug, It says it "expects a value for dbCustName".
my declarations are
Could not decide if it should go in this forum group or SQL...
Sorry if I posted to the wrong group.
Now every time I run this code I get "The conversion of the nvarchar value ' 4000545398' overflowed an int column. Maximum integer value exceeded."
Code as follows...
VB.NET:
[FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]' Get Customer NameUsing connObj2 As New SqlClient.SqlConnection("server=Server;database=App;uid=sa;pwd=password;")
Using cmdObj2 As New SqlClient.SqlCommand("SELECT c2.name, c2.cust_num from custaddr as c2 INNER JOIN co as c1 ON (c2.cust_num = c1.cust_num) INNER JOIN shipper as s1 on (c1.co_num = s1.co_num) WHERE c2.cust_seq = 0 AND lot = " & Carton1, connObj2)
connObj2.Open()
Using readerObj2 As SqlClient.SqlDataReader = cmdObj2.ExecuteReader
'This will loop through all returned records
While readerObj2.Read
dbCustNum = readerObj2("cust_num").ToString
dbCustName = readerObj2("name").ToString
'handle returned value before next loop here
End While
End Using
connObj2.Close()
End Using
End Using
[/SIZE][/FONT][/SIZE][/FONT]
My error comes at 'While readerObj2.Read'.
When I set around it in debug, It says it "expects a value for dbCustName".
my declarations are
VB.NET:
Dim dbCustName As String
Dim dbCustNum As String
Sorry if I posted to the wrong group.