Re: Upd SQL Srvr table with text file

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Nick Malik [Microsoft] (nickmalik_at_hotmail.nospam.com)
Date: 02/04/05


Date: Fri, 4 Feb 2005 07:15:34 -0800

Hi Marc,

There is nothing wrong, in theory, with using the same dataset object to
read from one database and write to another. However, you have to translate
your field and table names.

Once you read the dataset, you will need to create a table mapping to change
the column and field names for output.
http://msdn.microsoft.com/library/en-us/vbcon/html/vbwlkwalkthroughmappingdatasourcetablestodatasettables.asp

I'll be honest with you... this approach is for experts. While you end up
with less code, it is not something that can be easily explained.

If you do not feel comfortable with the level of detail in the
documentation, or the references to XML Schemas, you may be better off
simply using your dataset as an input mechanism, and then, taking each row
from the input and submitting a stored procedure call to write the data, one
row at a time, to the target database. It's more code, but it's more
achievable, and you'll understand it when you are done.

-- 
--- Nick Malik [Microsoft]
    MCSD, CFPS, Certified Scrummaster
    http://blogs.msdn.com/nickmalik
Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
   I do not answer questions on behalf of my employer.  I'm just a
programmer helping programmers.
--
"Marc Miller" <mm1284@hotmail.com> wrote in message
news:%234v43QgCFHA.956@TK2MSFTNGP12.phx.gbl...
> Nick,
>
> Thank you for your response and interest in my problem.  The code that I
am
> using to retrieve the text follows.  I have tried all sorts of ways to
> get the data set from the text retrieval into a data set to update the SQL
> Server table, but to not avail.
>
> I appreciate your help.
>
> Marc Miller
> '--------------------------------
> Dim ConnectionString As String = "Driver={Microsoft Text Driver (*.txt;
> *.csv)};DBQ=i:\groups\oracle\empldata\"
>
> Dim conn As Odbc.OdbcConnection = New
Odbc.OdbcConnection(ConnectionString)
> Dim ds As DataSet = New DataSet
>
> conn.Open()
>
> Dim da As Odbc.OdbcDataAdapter = New Odbc.OdbcDataAdapter("select * from
> empsdata.dat", conn)
>
> Try
>
> da.Fill(ds, "empsdata")
>
> '''''' The datagrid is just for verifying the data grab.
>
> dg.SetDataBinding(ds, "empsdata")
>
> '''''''
>
> '''' The next step is to load it into an SQL Server Table.
>
> Catch ex As OdbcException
>
> MessageBox.Show(ex.Message)
>
> End Try
>
> conn.Close()
>
>
>
>
>
>
>
>
> "Nick Malik [Microsoft]" <nickmalik@hotmail.nospam.com> wrote in message
> news:FrGdnZhaXK9lcp3fRVn-1Q@comcast.com...
> > Post what you have already.  It will help us to get you the rest of the
> way
> > there.
> >
> > -- 
> > --- Nick Malik [Microsoft]
> >     MCSD, CFPS, Certified Scrummaster
> >     http://blogs.msdn.com/nickmalik
> >
> > Disclaimer: Opinions expressed in this forum are my own, and not
> > representative of my employer.
> >    I do not answer questions on behalf of my employer.  I'm just a
> > programmer helping programmers.
> > --
> > "Marc Miller" <mm1284@hotmail.com> wrote in message
> > news:OlQoaQKCFHA.2180@TK2MSFTNGP12.phx.gbl...
> > > I'm trying to update (insert into) an SQL Server table with a dataset
> > > that I filled from an Odbc dataadapter.  I must be dumber than
> > > a rock, but I can't figure it out nor can I find any examples on the
> > > web.
> > >
> > > Could someone pleeeeze point me in the right direction?
> > >
> > > Tks,
> > > M. Miller
> > >
> > >
> >
> >
>
>


Relevant Pages

  • Re: Excel Alternatives
    ... > schedule to run on a perodic basis. ... database, and then just throw the data to the database? ... I do not answer questions on behalf of my employer. ... programmer helping programmers. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Encrypt ConnectionString in a *WINFORMS* App
    ... we're not going to have our DBAs add every user to the database... ... your config file, see ... I do not answer questions on behalf of my employer. ... programmer helping programmers. ...
    (microsoft.public.dotnet.general)
  • Re: i am having a problem in calling Dsn service insystem files of Vb.NET 2003 stuck here!
    ... How about you tell us what database you are trying to connect to? ... Opinions expressed in this forum are my own, and not representative of my employer. ... I'm just a programmer helping programmers. ... > From: Faisal Shamim ...
    (microsoft.public.dotnet.languages.vb)
  • Re: SQl Question with VB .NET
    ... > statement, send it to SQL Server or whatever database you are using, get ... > I do not answer questions on behalf of my employer. ... > programmer helping programmers. ...
    (microsoft.public.dotnet.general)
  • Re: Pattern Recognition
    ... > Computational Linguistics. ... Microsoft Research, IBM Research, and others are very ... > I do not answer questions on behalf of my employer. ... > programmer helping programmers. ...
    (microsoft.public.dotnet.languages.csharp)