Dataset(xsd) cannot insert. Why?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • creamy

    Dataset(xsd) cannot insert. Why?

    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.
  • =?Utf-8?B?anAybXNmdA==?=

    #2
    RE: Dataset(xsd) cannot insert. Why?

    Hi Creamy!

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

    JetDataAdapter (?) daAccess = new JetDataAdapter( strJetConnectio nString);
    DataTable dtAccess = new DataTable();
    SqlDataAdapter daSql = new SqlDataAdapter( strSqlConnetion );
    DataTable dtSql = new DataTable();
    daAccess.Fill(d tAccess);
    daSql.Fill(dtSq l);

    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.

    "creamy" wrote:
    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.
    >

    Comment

    Working...