CB
Clay Burch
Syncfusion Team
June 1, 2002 08:07 AM UTC
Check your code because I think this should work OK. In the C# code, it was "customers" and in the VB code, it was "customer". Did you mean to have it like this?
This code worked for me using the orders table from the northwind database.
Dim conStr As String
conStr = "Provider=Microsoft.JET.OLEDB.4.0;data source=C:\northwind.mdb"
Dim sqlStr As String
sqlStr = "SELECT * FROM Employees"
' Create connection object
Dim conn As OleDbConnection
conn = New OleDbConnection(conStr)
' Create data adapter object
Dim da As OleDbDataAdapter
da = New OleDbDataAdapter(sqlStr, conn)
' Create a dataset object and fill with data using data adapters Fill method
Dim ds As DataSet
ds = New DataSet()
da.Fill(ds, "Employees")
dataGrid1.DataSource = ds.Tables("Employees").DefaultView
dim dv as DataView = dataGrid1.DataSource
CType(dataGrid1.DataSource, DataView).AllowNew = False
JO
jolly
June 1, 2002 08:34 AM UTC
Thanks yet again! I'll try that. You have added a dim dv as DataView = dataGrid1.DataSource
which i did not do. thanks!! :)
> Check your code because I think this should work OK. In the C# code, it was "customers" and in the VB code, it was "customer". Did you mean to have it like this?
>
> This code worked for me using the orders table from the northwind database.
>
>
> Dim conStr As String
> conStr = "Provider=Microsoft.JET.OLEDB.4.0;data source=C:\northwind.mdb"
> Dim sqlStr As String
> sqlStr = "SELECT * FROM Employees"
> ' Create connection object
> Dim conn As OleDbConnection
> conn = New OleDbConnection(conStr)
> ' Create data adapter object
> Dim da As OleDbDataAdapter
> da = New OleDbDataAdapter(sqlStr, conn)
> ' Create a dataset object and fill with data using data adapters Fill method
> Dim ds As DataSet
> ds = New DataSet()
> da.Fill(ds, "Employees")
> dataGrid1.DataSource = ds.Tables("Employees").DefaultView
> dim dv as DataView = dataGrid1.DataSource
> CType(dataGrid1.DataSource, DataView).AllowNew = False
>