Dataset(xsd) cannot insert. Why?

C

creamy

Hi Guys,
There is the access DB, and the SQL server. I'm building an
application that can insert a new person, and details, into a DB.
(simple stuff?!) i'm however using a typed dataset created in visual
studio to an OleDb datasource. i then use the insert function to try
to insert into the DB.
the problem is it keeps raising errors depending on the DB chosen
(access or SQL) . if i create the dataset with access, it inserts only
to access. And when created with SQL server, it inserts only to SQL
server. Another prob is that even if i create the two datasets, how do
i determine which one to use depending on the DB the end user will be
using?

thanx for ur anticipated response.
 
J

jp2msft

Hi Creamy!

You may want to ditch the visual dataset tool and create your datasets
programatically in code:

JetDataAdapter (?) daAccess = new JetDataAdapter(strJetConnectionString);
DataTable dtAccess = new DataTable();
SqlDataAdapter daSql = new SqlDataAdapter(strSqlConnetion);
DataTable dtSql = new DataTable();
daAccess.Fill(dtAccess);
daSql.Fill(dtSql);

Untested code. I don't use Access anymore, so I don't know what the
DataAdapter for it would be.

Of course, there are many more things to do using your databases, but the
code above should give you a kickstart in the right direction.
 

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

Similar Threads


Top