Basic asp.net 2.0 question about the dataset

N

needin4mation

If I have a legacy database that I cannot use the Drag and Drop dataset
tools with Visual Studio, is the correct (only) way to get to the data
using a DSN on the machine like so:

DataSet ds = new DataSet();
OdbcConnection conn = new
OdbcConnection("DSN=myDSN;uid=xxx;pwd=xxx");
OdbcDataAdapter myAdapter = new OdbcDataAdapter(sqlString,
conn);
myAdapter.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();

I remember doing this a lot in 1.x, but didn't know if this was still
the way to do it (is this above just wrong for 2.0). As I said, the
database is old, legacy, so I couldn't not use any of the drag and
drop. I could get the wizard to come up, but I could not do things
like use variables such as with Sql Server @myVar.

Incidentally, is this using of the dataset with Sql Server and VS using
a ".net provider" for the database? Is that the big deal with database
companies producing a ".net provider" with the database (like mysql or
oracle) so that one can develop just like they can with sql server -
visually?

Thank you for any help.
 
M

Mark Rae

If I have a legacy database that I cannot use the Drag and Drop dataset
tools with Visual Studio, is the correct (only) way to get to the data
using a DSN on the machine like so:

DataSet ds = new DataSet();
OdbcConnection conn = new
OdbcConnection("DSN=myDSN;uid=xxx;pwd=xxx");
OdbcDataAdapter myAdapter = new OdbcDataAdapter(sqlString,
conn);
myAdapter.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();

There's certainly nothing wrong with your database access methodology,
assuming that ODBC is *really* your only connectivity option...
As I said, the database is old, legacy

What RDBMS is it, AAMOI...?
Incidentally, is this using of the dataset with Sql Server and VS using
a ".net provider" for the database? Is that the big deal with database
companies producing a ".net provider" with the database (like mysql or
oracle) so that one can develop just like they can with sql server -
visually?

A native .NET is designed to provide the most efficient means of
connectivity between the .NET Framework (ADO.NET, specifically) and the
RDBMS - most, but not all, also provide the visual tools. I never use these,
because I much prefer to use a DAL (Data Abstraction Layer).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top