473,385 Members | 1,317 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Using Dataset's

Hi, I've got a scenario where I have two different data sources, one is an
SQL server and the other is a Foxpro DBF table. What I'm trying to do is
take data from the SQL server and place it into the DBF table this is the
code I have so far.

Expand|Select|Wrap|Line Numbers
  1. '======= SQL Connection ======
  2. Dim strConn As String = "user id=*******;password=*******;data
  3. source=***.***.***.***;persist security info=False;initial catalog=*******"
  4. Dim sqlCon As New SqlConnection(strConn)
  5. Dim objDR As SqlDataReader
  6. Dim objDA As New SqlDataAdapter
  7. Dim objDS As New DataSet
  8. '==============================
  9. Try
  10. 'Open Connection
  11. sqlCon.Open()
  12. 'Define SQL command
  13. objDA.SelectCommand = New SqlCommand("contacts", sqlCon)
  14. 'Execute SQL command
  15. objDA.Fill(objDS, "contacts")
  16.  
  17. Catch strError As Exception
  18. MessageBox.Show(strError.ToString)
  19. Finally
  20. 'Close and Dispose Connection
  21. sqlCon.Close()
  22. sqlCon.Dispose()
  23. End Try
  24. '==============================
  25.  
  26. 'Foxpro ODBC Connection
  27. Dim strFoxProConn As String = "Driver={Microsoft Visual FoxPro
  28. Driver};SourceType=DBF;SourceDB=c:\;Exclusive=No"
  29. Dim OdbcConn As New OdbcConnection(strFoxProConn)
  30. '==============================
  31.  
  32.  
I have created a SQL connection to the SQL server and returned the data to a
dataset. I have then created a ODBC connection to the DBF table, this is
where I am now stuck and not too sure what to do. My knowledge of VB.NET is
not great that's why I'm posting on here with the hope that somebody can
point me in the right direction of what to do next.

Thanks in Advance.

--
Martin
Nov 20 '05 #1
1 1070
ill fill in the first part ;)
'==============================

'Foxpro ODBC Connection
Dim strFoxProConn As String = "Driver={Microsoft Visual FoxPro
Driver};SourceType=DBF;SourceDB=c:\;Exclusive=No"
Dim OdbcConn As New OdbcConnection(strFoxProConn)
'==============================
dim r as datarow
for each r in objDS.tables(0).rows
'insert the value of r(0) in your dbf file (row per row)
next
[/code]


hope it helps

eric
Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: DraguVaso | last post by:
Hi, Something I don't understand about a Typed DataSet: When a value in the DataSet is DBNull, it throws this error: "Cannot get value because it is DBNull". But aren't Typed DataSets...
1
by: Shaileen Patel | last post by:
Hi, I am trying to convert a lot of web reports from ASP/VB to ASP.NET/VB.NET. I would like to save my dataset in XML and then use XSLT to transform the XML. The catch is I would like to have...
0
by: Michelle Keys | last post by:
I am trying to call a print function to print a string from a database using javascript. Which is RC_DATA of Varchar2(2500). This is a javascript is not being used. I have a thing that needs to...
8
by: John | last post by:
Hi I need to be able to call a web service method, receive the dataset that web method returns and store it in an access table. My problem is that I don't know how to "receive" a complex type...
1
by: Kevin S. Goff | last post by:
Hi, all, Hopefully this will make sense: I have 2 classes that implement the same generic interface. public interface IAgingReport<T> { T GetAgingReport(DateTime dAsOfDate); }
5
by: Monty M. | last post by:
Hello; I was wondering if anyone can assist me with this problem. Here are the tools I am using: Language: C# Database: MS SQL Server 2000 Application: Visual Studio 2005 1. I have a...
7
by: Ryan | last post by:
Quite awile ago I posted to this newsgroup in regards to using Datasets in my VB 2005 application. About how many Datasets should be used.. a limit to the number of tables that should be included...
2
by: rrflore2 | last post by:
Ok. I'm writing and deleting to an xml file using a dataset. I have a function in my codebehind page that binds a listbox to the dataset that performs the writes/deletes. Everything seems to be...
0
MrMancunian
by: MrMancunian | last post by:
How to create a database connection without using wizards Introduction I've seen a lot of questions on the net about getting data from, and saving data to databases. Here's a little insight how...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.