469,322 Members | 1,605 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,322 developers. It's quick & easy.

Datagrid Problem- Run time error'6'- overflow

24
Dear All,

I m connecting my sql data with the data grid, but not all columns only particular columns. having certain conditions, but it is showing the error as Runtime Error '6- overflow...

please help me....

Regards
Lucky13
Oct 17 '07 #1
13 2337
nev
251 100+
dataadapter = New MySqlDataAdapter("SELECT column1,column2,column3 FROM tablename", connection)

dataadapter.Fill(datatable)

datagridview.datasource = datatable

or

dataadapter = New MySqlDataAdapter("SELECT * FROM tablename", connection)

dataadapter.Fill(datatable)

datatable.column(column).clomnmapping = columnmapping.hidden

datagridview.datasource = datatable

or

dataadapter = New MySqlDataAdapter("SELECT * FROM tablename", connection)

dataadapter.Fill(datatable)

datagridview.datasource = datatable

if lcase(datagridview.column(column).name.tostring) = "column" then
datagridview.column(column).visible = false
end if
Oct 17 '07 #2
lucky13
24
Hello Nev,

thanks for the immediate reply, but i m sorry , i typed the wrong database as mysql, actually it is sql server 2000.



dataadapter = New MySqlDataAdapter("SELECT column1,column2,column3 FROM tablename", connection)

dataadapter.Fill(datatable)

datagridview.datasource = datatable

or

dataadapter = New MySqlDataAdapter("SELECT * FROM tablename", connection)

dataadapter.Fill(datatable)

datatable.column(column).clomnmapping = columnmapping.hidden

datagridview.datasource = datatable

or

dataadapter = New MySqlDataAdapter("SELECT * FROM tablename", connection)

dataadapter.Fill(datatable)

datagridview.datasource = datatable

if lcase(datagridview.column(column).name.tostring) = "column" then
datagridview.column(column).visible = false
end if
Oct 17 '07 #3
QVeen72
1,445 Expert 1GB
Hi,

What SQL Statement you have used for the data adapter..?

Regards
Veena
Oct 17 '07 #4
lucky13
24
Hello,

Sorry, i m wrongly typed the my sql, i m using sql server 2000
Oct 17 '07 #5
QVeen72
1,445 Expert 1GB
Hi,

My question was.. Whatever backend database...,
What is the SQL Statement ...?

and VB6 or VB.Net..?

REgards
Veena
Oct 17 '07 #6
lucky13
24
Hello

i m usiing VB6,

here i create column hearder & my sql statement is as follow

sql = "Select Cust_Code, sum(Net_Payment)as Net_Payment from Payment_Paid_Status where Payment_Month>='" & strmonth & "' And Payment_Month= '" & strmonth_1 & "' and Tool_Category='" & cmbcategory.Text & "' group by Cust_code"
rsdetails.Open sql, con, adOpenDynamic, adLockBatchOptimistic


Regards,


Hi,

My question was.. Whatever backend database...,
What is the SQL Statement ...?

and VB6 or VB.Net..?

REgards
Veena
Oct 17 '07 #7
QVeen72
1,445 Expert 1GB
Hello

i m usiing VB6,

here i create column hearder & my sql statement is as follow

sql = "Select Cust_Code, sum(Net_Payment)as Net_Payment from Payment_Paid_Status where Payment_Month>='" & strmonth & "' And Payment_Month= '" & strmonth_1 & "' and Tool_Category='" & cmbcategory.Text & "' group by Cust_code"
rsdetails.Open sql, con, adOpenDynamic, adLockBatchOptimistic


Regards,
Hi,
Check these:
does net_payment have Null..?

"Payment_Month>='" & strmonth
above means you are checking for Greater, but strmonth is text...
same for strMonth1 (are you sure data types match..?)


Regards
Veena
Oct 17 '07 #8
lucky13
24
Hello Veena,
Net_payment is not null, & in another form i used the same strmonth & it works..

First time i am trying to connect grid to sql data...

i think i m doung something worng while connecting to grid... see the whole code for connecting to grid...

Expand|Select|Wrap|Line Numbers
  1. Private Sub Connectgrid()
  2.  
  3. Dim rsdetails As New ADODB.Recordset
  4. Dim i As Integer
  5.  
  6. con.Open
  7.  
  8. Call Month_Conv
  9.  
  10. sql = "Select Cust_Code, sum(Net_Payment)as Net_Payment from Payment_Paid_Status where Payment_Month>='" & strmonth & "' And Payment_Month= '" & strmonth_1 & "' and Tool_Category='" & cmbcategory.Text & "' group by Cust_code"
  11.  
  12. rsdetails.Open sql, con, adOpenDynamic, adLockBatchOptimistic
  13.  
  14. If rsdetails.RecordCount > 0 Then
  15.     rsdetails.MoveNext
  16. End If
  17.  
  18. If Not (rsdetails.EOF And rsdetails.BOF) Then
  19.  
  20.     With rsdetails
  21.  
  22.         dgpaydetails.Row = !Cust_Code // here i am facing the problem.....
  23.         dgpaydetails.Row = !Net_Breaks
  24.  
  25.     End With
  26.  
  27. End If
  28.  
  29.  
  30. End Sub
  31.  
  32.  
Regards
Oct 18 '07 #9
QVeen72
1,445 Expert 1GB
Hello Veena,
Net_payment is not null, & in another form i used the same strmonth & it works..

First time i am trying to connect grid to sql data...

i think i m doung something worng while connecting to grid... see the whole code for connecting to grid...

Expand|Select|Wrap|Line Numbers
  1. Private Sub Connectgrid()
  2.  
  3. Dim rsdetails As New ADODB.Recordset
  4. Dim i As Integer
  5.  
  6. con.Open
  7.  
  8. Call Month_Conv
  9.  
  10. sql = "Select Cust_Code, sum(Net_Payment)as Net_Payment from Payment_Paid_Status where Payment_Month>='" & strmonth & "' And Payment_Month= '" & strmonth_1 & "' and Tool_Category='" & cmbcategory.Text & "' group by Cust_code"
  11.  
  12. rsdetails.Open sql, con, adOpenDynamic, adLockBatchOptimistic
  13.  
  14. If rsdetails.RecordCount > 0 Then
  15.     rsdetails.MoveNext
  16. End If
  17.  
  18. If Not (rsdetails.EOF And rsdetails.BOF) Then
  19.  
  20.     With rsdetails
  21.  
  22.         dgpaydetails.Row = !Cust_Code // here i am facing the problem.....
  23.         dgpaydetails.Row = !Net_Breaks
  24.  
  25.     End With
  26.  
  27. End If
  28.  
  29.  
  30. End Sub
  31.  
  32.  
Regards
Hello,

To display Recordset Results to DataGrid, all you have to do is :

Expand|Select|Wrap|Line Numbers
  1. rsdetails.CursorLocation = adUseClient
  2. rsdetails.Open sql, con, adOpenStatic, adLockReadOnly
  3.     With dgpaydetails
  4.         .DataMember = ""
  5.         Set .DataSource = rsdetails
  6.         .Refresh
  7.     End With
  8.  
Regards
Veena
Oct 18 '07 #10
lucky13
24
Hello,

thanks veena, it is working but if u see my query in that i have mention sum function with group by clause. but as per u r solution recordset is showing individual net amount, & that to for the last record for that particular customer.

means for particular customer there are three records & i want net-amount of that three records, but by this i am getting only the amount to third record.
sorry for troubling so much...

Regards


Hello,

To display Recordset Results to DataGrid, all you have to do is :

Expand|Select|Wrap|Line Numbers
  1. rsdetails.CursorLocation = adUseClient
  2. rsdetails.Open sql, con, adOpenStatic, adLockReadOnly
  3.     With dgpaydetails
  4.         .DataMember = ""
  5.         Set .DataSource = rsdetails
  6.         .Refresh
  7.     End With
  8.  
Regards
Veena
Oct 18 '07 #11
QVeen72
1,445 Expert 1GB
Hi,

I have not changed the SQL Query..
Did you Run the Query at Back end and checked..?


Regards
Veena
Oct 18 '07 #12
lucky13
24
Hi,

thanks veena, when i checked in the backend there , but there is also same result, only showing last record. then i checked i query , there is one mistake that in near strmonth_1 i have not mentioned the less than sign........

thanks a lot.

can u do one more favour for me.... if i want to add user data through data grid... in adding one more column ,, so which property i have to use...ADDNEWMODE or ALLOW ADD NEW.....

thanks a lot once again...........

Regards
Lucky13


Hi,

I have not changed the SQL Query..
Did you Run the Query at Back end and checked..?


Regards
Veena
Oct 18 '07 #13
Hello,

To display Recordset Results to DataGrid, all you have to do is :

Expand|Select|Wrap|Line Numbers
  1. rsdetails.CursorLocation = adUseClient
  2. rsdetails.Open sql, con, adOpenStatic, adLockReadOnly
  3.     With dgpaydetails
  4.         .DataMember = ""
  5.         Set .DataSource = rsdetails
  6.         .Refresh
  7.     End With
  8.  
Regards
Veena
Thanks Veena,
You've solved my problem too without me even having to ask!

Cheers
Ninj
Oct 26 '07 #14

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Bill Sonia | last post: by
2 posts views Thread by Chris Plowman | last post: by
1 post views Thread by Joe Bloggs | last post: by
5 posts views Thread by Jeff | last post: by
reply views Thread by mgenti | last post: by
3 posts views Thread by vinayak | last post: by
reply views Thread by Curtis Hatter | last post: by
5 posts views Thread by John M | last post: by
2 posts views Thread by =?Utf-8?B?Y3JlYXZlczA2MjI=?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.