Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET Desktop
Hi all
 
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 23-Sep-12 21:12pm
(unknown member)

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Just use databinding to retireve data from database
  Permalink  
Comments
snehasish nandy at 24-Sep-12 5:11am
   
plz give me some examples..
Ervin Pacibe at 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)



Advertise | Privacy | Mobile
Web01 | 2.8.140827.1 | Last Updated 24 Sep 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100