Click here to Skip to main content
15,891,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all

VB
Dim ds1 As New DataSet()
       'Dim ds As New DataSet()
       Dim sql1 As String = "SELECT  sum(present) FROM attendance where present='1' and Emp_id='" & TextBox1.Text & "'"
       Dim connection As New SqlConnection(str)
       Dim dataadapter1 As New SqlDataAdapter(sql1, str)
       connection.Open()
       dataadapter1.Fill(ds1, "attendance")
       'ds.Tables(0).Rows(0)(0) = ds1.Tables(0).Rows(0)(0)
       DataGridView2.DataSource = ds1.Tables(0).Rows(0)(0)
       connection.Close()
       'DataGridView2.DataSource = ds1.Tables(0).Rows(0)(0)
       'DataGridView2.DataMember = "attendance"


i wrote the above code to bind a value in a specific column in a datagrid.but it's not working..please tell me the problem..
and i wrote one same function with 3 values which i am binding in the same datagrid.
Posted

1 solution

Just use databinding to retireve data from database
 
Share this answer
 
Comments
[no name] 24-Sep-12 5:11am    
plz give me some examples..
xErvender 24-Sep-12 22:40pm    
try to use DataTable

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900