I'm trying to learn a bit of asp.net 2.0 and am having problems getting my head around the AccessDataSource control.
I'm trying to get a single field out of the table.
The row looks something like: ID (int), Role(string)
So I have my AccessDataSource all configured up to point at the DB, which all looks good in the previews etc.
In the code I have tried:
myVariable = 1 AccessDataSource1.SelectCommand = "SELECT [Role] FROM [tbl_standard_roles] WHERE ([ID] = " & myVariable & ")" myRole = AccessDataSource1.Select(DataSourceSelectArguments.Empty)
no luck, so I tried:
myVariable = 1 AccessDataSource1.SelectCommand = "SELECT [Role] FROM [tbl_standard_roles] WHERE ([ID] = " & myVariable & ")" Dim dv As Data.DataView = AccessDataSource1.Select(DataSourceSelectArguments.Empty) myRole = dv.ToTable.Rows(0)(1).ToString
again no luck.
The AccessDataSource1.Select just doesn't seem to be returning anything - there's definitely a record with 1 as the ID - so I'm at a complete loss as to how to access data, I'm assuming there is a way getting back a recordset from the AccessDataSource control? or do I need to go back to the old DataSets, etc?
i havn't used this data source but are you sure your SQL is well formed. Do you NEED the square brackets around the field and table names. I only ask this because with the normal SQLConnection objects in .net you just write sql like this.