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
13 2385
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
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
Hi,
What SQL Statement you have used for the data adapter..?
Regards
Veena
Hello,
Sorry, i m wrongly typed the my sql, i m using sql server 2000
Hi,
My question was.. Whatever backend database...,
What is the SQL Statement ...?
and VB6 or VB.Net..?
REgards
Veena
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
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
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... -
Private Sub Connectgrid()
-
-
Dim rsdetails As New ADODB.Recordset
-
Dim i As Integer
-
-
con.Open
-
-
Call Month_Conv
-
-
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
-
-
If rsdetails.RecordCount > 0 Then
-
rsdetails.MoveNext
-
End If
-
-
If Not (rsdetails.EOF And rsdetails.BOF) Then
-
-
With rsdetails
-
-
dgpaydetails.Row = !Cust_Code // here i am facing the problem.....
-
dgpaydetails.Row = !Net_Breaks
-
-
End With
-
-
End If
-
-
-
End Sub
-
-
Regards
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... -
Private Sub Connectgrid()
-
-
Dim rsdetails As New ADODB.Recordset
-
Dim i As Integer
-
-
con.Open
-
-
Call Month_Conv
-
-
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
-
-
If rsdetails.RecordCount > 0 Then
-
rsdetails.MoveNext
-
End If
-
-
If Not (rsdetails.EOF And rsdetails.BOF) Then
-
-
With rsdetails
-
-
dgpaydetails.Row = !Cust_Code // here i am facing the problem.....
-
dgpaydetails.Row = !Net_Breaks
-
-
End With
-
-
End If
-
-
-
End Sub
-
-
Regards
Hello,
To display Recordset Results to DataGrid, all you have to do is : -
rsdetails.CursorLocation = adUseClient
-
rsdetails.Open sql, con, adOpenStatic, adLockReadOnly
-
With dgpaydetails
-
.DataMember = ""
-
Set .DataSource = rsdetails
-
.Refresh
-
End With
-
Regards
Veena
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 : -
rsdetails.CursorLocation = adUseClient
-
rsdetails.Open sql, con, adOpenStatic, adLockReadOnly
-
With dgpaydetails
-
.DataMember = ""
-
Set .DataSource = rsdetails
-
.Refresh
-
End With
-
Regards
Veena
Hi,
I have not changed the SQL Query..
Did you Run the Query at Back end and checked..?
Regards
Veena
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
Hello,
To display Recordset Results to DataGrid, all you have to do is : -
rsdetails.CursorLocation = adUseClient
-
rsdetails.Open sql, con, adOpenStatic, adLockReadOnly
-
With dgpaydetails
-
.DataMember = ""
-
Set .DataSource = rsdetails
-
.Refresh
-
End With
-
Regards
Veena
Thanks Veena,
You've solved my problem too without me even having to ask!
Cheers
Ninj
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
|
1 post
views
Thread by Ken Varn |
last post: by
|
2 posts
views
Thread by =?Utf-8?B?Y3JlYXZlczA2MjI=?= |
last post: by
| | | | | | | | | | |