Bind the DataGrid..?

K

Kent Johnson

Hi all,

How can I get data to show in a datagrid?
This is what I have tested:
===============================
Dim ConnStr As String
ConnStr = "data source=MyServer;initial catalog=pubs;persist security
info=True;workstation id=LABSERVER;packet size=4096;user id=sa

Dim SQLSelect As String
SQLSelect = "SELECT * FROM Titles"

Dim mySqlConn As New System.Data.SqlClient.SqlConnection(ConnStr)
Dim mySqlDA As New System.Data.SqlClient.SqlDataAdapter(SQLSelect, ConnStr)

Dim myDS As New DataSet()

mySqlConn.Open()
mySqlDA.Fill(myDS)
DataGrid2.DataBind()
mySqlConn.Close()
================================
I get no errormessage.

What can be wrong?

/Kent J.
 
K

Kent Johnson

Teemu,

No, I hadn't done that. That fixed it!
Thanks!

Do you happen to know how I can store the fields in memVar when I retrive
one record from the recordset?

Example:
Field1= strVar1
Field2=strVar2
Field3=strVar3

I'm planning to use those fields for calculations.

I guess I have to loop through the fields somehow.

/Kent J.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top