| | |
Displaying record from SQL Server in a grid
![]() |
•
•
Join Date: May 2008
Posts: 23
Reputation:
Solved Threads: 0
Pls see my code.Nothing is displaying in the grid
VB.NET Syntax (Toggle Plain Text)
Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim connString As String = "Provider=SQLOLEDB;Data Source=MSALAMEEN;uid=sa;pwd=Sa1;Initial Catalog=Biometric" Dim myConnection As OleDbConnection = New OleDbConnection myConnection.ConnectionString = connString Dim da As OleDbDataAdapter = New OleDbDataAdapter("Select ID from bdata", myConnection) Dim ds As DataSet = New DataSet Dim dc1 As DataColumn = New DataColumn 'da.Fill(ds) da.Fill(ds, "bdata") dc1 = ds.Tables("bdata").Columns("id") DataGridView1.DataSource = ds.DefaultViewManager
Last edited by John A; Aug 21st, 2009 at 6:33 pm. Reason: added code tags
@jbisono:
No, It's not working. It is for ASP.NET.
add this at the end. DataGridView1.DataBind()No, It's not working. It is for ASP.NET.
vb.net Syntax (Toggle Plain Text)
DataGridView1.DataSource = ds.Table("bdata")
•
•
•
•
Pls see my code.Nothing is displaying in the grid
VB.NET Syntax (Toggle Plain Text)
Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim connString As String = "Provider=SQLOLEDB;Data Source=MSALAMEEN;uid=sa;pwd=Sa1;Initial Catalog=Biometric" Dim myConnection As OleDbConnection = New OleDbConnection myConnection.ConnectionString = connString Dim da As OleDbDataAdapter = New OleDbDataAdapter("Select ID from bdata", myConnection) Dim ds As DataSet = New DataSet Dim dc1 As DataColumn = New DataColumn 'da.Fill(ds) da.Fill(ds, "bdata") dc1 = ds.Tables("bdata").Columns("id") DataGridView1.DataSource = ds.DefaultViewManager
After the last line add
DataGridView1.DataMember = "bdata" ![]() |
Similar Threads
- Importing csv file to SQL Server Using VB.Net (VB.NET)
- SQL Server Developer, Manchester, UK (Software Development Job Offers)
- image not displaying in grid view form sql server & ASP.NET. anyone help me if u knw? (ASP.NET)
- can we get the position of record while retriving records in sql server 2003 (MS SQL)
- vb.net and SQL Server 2000 (VB.NET)
- How to Connect to an SQl server using C language (C)
- SQL Server DBA - " Hot " (Software Development Job Offers)
- SQL Server DBA (Software Development Job Offers)
- Connecting to a SQL Server Database using VB (VB.NET)
Other Threads in the VB.NET Forum
- Previous Thread: Backing Up Oracle
- Next Thread: Want to Terminate a Process handle
Views: 555 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2005 2008 access ado.net application array arrays basic bindingsource browser c# capture center checkbox client code combobox communication connection control convert crystal crystalreport data database datagrid datagridview dataset datatable date datetimepicker design designer dissertation dissertations error excel file form gridview image images insert listview login loops mobile ms msaccess net objects openxml path port post print printing problem read save search security serial server settings sms socket sorting sql statement studio syntax tagging tags textbox time timer type update upload user validation vb vb.net vb2008 view visual visual-studio visualbasic visualbasic.net visualstudio2008 vs2008 web webbrowser windows winforms wpf xml






