Click here to Skip to main content
12,758,462 members (30,148 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB 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)
       dataadapter1.Fill(ds1, "attendance")
       'ds.Tables(0).Rows(0)(0) = ds1.Tables(0).Rows(0)(0)
       DataGridView2.DataSource = ds1.Tables(0).Rows(0)(0)
       '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 22:12pm

1 solution

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

Solution 1

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

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170217.1 | Last Updated 24 Sep 2012
Copyright © CodeProject, 1999-2017
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