Groups | Blog | Home
all groups > dotnet ado.net > march 2008 >

dotnet ado.net : Datasource from string


John
3/18/2008 1:59:26 AM
Hi

Is it possible to create a datasource for dataview control for an sql
string?

Thanks

Regards

Cor Ligthert[MVP]
3/18/2008 5:21:39 AM
John,

A dataview is not a control, it is a view on the datatable.

Cor


"John" <info@nospam.infovis.co.uk> schreef in bericht
news:OqCeyuJiIHA.5160@TK2MSFTNGP05.phx.gbl...
[quoted text, click to view]
jp2msft
3/18/2008 5:55:00 AM
John,

Not really. You need to create a new datasource that uses your sql string:

Dim sql as String = "SELECT * FROM Table1"
Dim con as String = "Data Source=Northwind;Initial Catalog=Table1;Integrated
Security=True"
Dim ds as DataSource = new DataSource(sql, con)

The code above is untested, though. I think it needs the sql connection
string, but I could be mistaken.

Hope that helps!

[quoted text, click to view]
John
3/18/2008 6:13:57 PM
Sorry I meant gridvview.

[quoted text, click to view]

Patrice
3/18/2008 7:26:30 PM
Not sure though what you meant ? A string is just a string, you have to
execute the Sql statement that is stored into this string to produce a
result that can then be binded to a gridview...

Search google for gridview/databind or elaborate a bit about what you are
trying to do (are you looking for SqlDataSource like objects ? -
http://msdn2.microsoft.com/en-us/library/dz12d98w(vs.80).aspx)...

--
Patrice

"John" <info@nospam.infovis.co.uk> a écrit dans le message de news:
O$ILVPSiIHA.4076@TK2MSFTNGP05.phx.gbl...
[quoted text, click to view]

AddThis Social Bookmark Button