Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grid Problem on WebForm

Status
Not open for further replies.

ronnetp

Programmer
Apr 8, 2002
71
I have the following code for a Windows Form and it works great, but when I try to do the same on a Webform I get this error

WebForm1.aspx.vb(42): 'SetDataBinding' is not a member of 'System.Web.UI.WebControls.DataGrid'.

Dim strconnection As String = "user id=sa;password=cadasa;database=sportstech;server=servera1"
Dim cn As SqlConnection = New SqlConnection(strconnection)
Dim strSQL As String = "select pin,firstname,lastname,ccpassword,inetpassword from bettormain nolock where enabled = 1 order by pin"
Dim registros As Integer

cn.Open()

Dim da As SqlDataAdapter = New SqlDataAdapter(strSQL, cn)
Dim ds As DataSet = New DataSet()
da.Fill(ds, "bettormain")
profilegrid.SetDataBinding(ds, "bettormain")

da.Dispose()
ds.Dispose()
cn.Close()
 
For a web form datagrid, do:

profilegrid.datasource = ds.Tables("bettormain")
profilegrid.databind

D'Arcy
 
It worked, REALLY appreaciate your help.

I wish you the best

Thanks,

Ronnet
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top