Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004

    Angry Unanswered: SQL Server Select Into Local Access DB

    I am having trouble figuring out how to accomplish this task. I need a way to run a select statement on a table on a SQL Server (on a network) and put the results in a access database on another computer on the network. I am using ADO with C++. The access database will already be created on the target computer and will have a replica of the table that the select statement is occuring on.

    Currently, I create a connection to the SQL server and create a RecordSet that has the needed records selected using the select statement. I also have a connection to the local access database. I am looking for a way to do a select into or insert into on the RecordSet for the SQL Server and put the results in the local access database. This code would be run from the computer that the access database needs to be created on.

    Thanks in Advance,


  2. #2
    Join Date
    Feb 2004
    In front of the computer
    Provided Answers: 54
    DTS would be my first choice. If your teacher wants you to learn to use specific tools, then you'll need to give me some clues so I can offer a better suggestion.


  3. #3
    Join Date
    Mar 2004
    I am currently using DTS with C++ but when I convert date field, the DTS fails. If I don't convert the date field. The transfer works fine.

    I am doing the Column setup like this:
    ColumnPtr SrcColumn, TrgColumn;
    CString sColumn = pSrc->GetFirstColumnName();
    int i = 1;

    do {
    SrcColumn = pTrans->SourceColumns->New((_bstr_t)sColumn, i);
    SrcColumn->DataType = pSrc->GetFieldType(sColumn);
    TrgColumn = pTrans->DestinationColumns->New((_bstr_t)sColumn, i);
    TrgColumn->DataType = pTrg->GetFieldType(sColumn);
    } while ((sColumn = pSrc->GetNextColumnName()) && !sColumn.IsEmpty());

    The pSrc and pTrg are Ado Record Set classes objects. After I finish the Column setup I finish the setup and execute the DTS. If I skip the Date column the DTS works and if I include it, the DTS fails.

    Any ideas?



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts