Re: connect to sql server
i would tried it this way
Code:
Dim con As SqlConnection = New SqlConnection ("Server=localhost;Database = Northwind;Integrated Security = SSPI;")
Dim da As New SqlDataAdapter()
Dim dataset As New DataSet()
Dim cmd As SqlCommand = New SqlCommand("select * from Customers", con)
cmd.Connection.Open()
da.SelectCommand = cmd
da.Fill(DataSet, "Customers")
Me.DataGrid1.SetDataBinding(dataset, "Customers")
cmd.Connection.Close()
Re: connect to sql server
im getting an error on SetDataBinding so i tried to use dataSource+dataBind
but its still not working, i cant see anything.
what else can it be?
Re: connect to sql server
Re: connect to sql server
'SetDataBinding' is not a member of 'System.Web.UI.WebControls.DataGrid'
Re: connect to sql server
try this instead of
Code:
datagrid1.dataBind
Me.dataBind
Re: connect to sql server
Take a look at this Sample