473,785 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Create a offline database

4 New Member
Hi,
I am trying to create an offline database in VB.NET 2005, both the online and offline database use SQL Server 2005.
The code I am using seems to run OK with out an exception the DATASET has the records added, but the UPDATE will not update the offline database. (The offline database is empty before I start)

Q1) what am I doing wrong?
Q2) is there a better way of coping data to an offline SQL database?

My code
Expand|Select|Wrap|Line Numbers
  1.  
  2. Try
  3.     da = New SqlDataAdapter(SQLcmd)
  4.     conSQL.Open()
  5.     da.Fill(dsOffLine, "TableName")
  6.     dtOffLine= dsOffLine.Tables(0)
  7.     Dim dsRow As DataRow
  8.     Dim dsRowB As DataRow
  9.  
  10. 'Online DS loaded earlier
  11.     For Each dsRow In frmMain.dsOnLine.Tables("TableName").Rows
  12.         dsRowB = dtOffLine.NewRow()
  13.         dsRowB.ItemArray = dsRow.ItemArray
  14.         dtOffLine.Rows.Add(dsRowB)
  15.         ''    Tried this instead of the above three rows
  16.          '     dtOffLine.ImportRow(dsRow)
  17.    Next
  18.  
  19.      dtOffLine.AcceptChanges()
  20.      da.Update(dsOffLine, "TableName")
  21.      conSQL.Close()
  22. Catch ex As Exception
  23.      MsgBox(ex.ToString)
  24. End Try
  25.  

Thanks

Eric
May 17 '07 #1
2 1999
ericthered
4 New Member
Ok I have resolved the issue with two lines of code.

Remove line 18
Expand|Select|Wrap|Line Numbers
  1. dtOffLine.AcceptChanges()
  2.  
And add a line after line 2

Expand|Select|Wrap|Line Numbers
  1. Dim builder As SqlCommandBuilder = New SqlCommandBuilder(da) 
  2.  
Thanks
May 18 '07 #2
kenobewan
4,871 Recognized Expert Specialist
Well done! Thanks for sharing the solution.
May 18 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1126
by: NohaKhalifa | last post by:
Dear All ; I have a web site and i made it's administration offline using asp . I want after I fill a data in the offline database, onclick a button this data sent online . The problem is that the site contains images and i want to send it offline on database and at the same time send upload these images online on click this button ...I want both actions to be from the same page or window .
1
6425
by: Moti | last post by:
Hello, I am trying to check the integrity of SQL database. The 'problem' with SQL server is that it's fixing the DB automatically after restore so I need a way to do it offline, much like using eseutil on Exchange databases. Thanks in advance.
0
1614
by: moko | last post by:
This is a bit long-winded. Can somebody read thru these 2 use cases, and tell me if it is feasible ? :- Use Case : Replication before Offline Synch Scenario 1 : Oracle Server , MSDE client 1. User clicks on 'Go Offline'. System creates a MSDE SQL database in laptop (client), gets the schemas of the tables in Oracle, creates corresponding tables in client's MSDE SQL (mapping Oracle datatypes to SQL
2
7314
by: Buck Turgidson | last post by:
I have an SAP development system running on Linux. It is not a critical system, but I would like a restore-able backup. I have taken an offline backup, but I am unable to restore it. I am guessing I need to quiesce the database somehow and get it into an offline state. What are commands to do so in db2? This is what I get when Itry to restore.
1
2660
by: intl04 | last post by:
I am getting strange print-related error messages when trying to create (not print!) reports. For example, when I click 'new' to create a report then choose 'design view', I get an error message that says: 'There was a problem retrieving printer information for this object. The object may have been sent to a printer that was unavailable.' When I choose 'report wizard', I can go through all of the steps but then I get an error message...
2
1651
by: John | last post by:
Hi I need to develop an app in vb 2005 which can work in both offline and online modes and will be running on client laptops. I have listened to the following web cast; http://msevents.microsoft.com/CUI/WebCastEventDetails.aspx?EventID=1032271522&EventCategory=3&culture=en-US&CountryCode=US What I need to know is, do the laptops need to have a local version of sql server (mobile, express etc.) to accomplish the offline mode?
3
6919
by: Alex | last post by:
Hello, I am running an Access 2003 database, quite modest in size, that is used by upwards of 5 users. I need to modify the database such that these users can work simultaneously and, in some cases, offline. It is split to front and back ends and works over Citrix. So the multi-user is working fine.
0
1642
by: prashanthdb2 | last post by:
Hi, Im new to db2. Im using db2 ese 9.1 (fix pack 1) on SLES 9.0 32 bit. I have single instance on three logical nodes 0,1,2. i have cofigured userexit - on, logretain - on, trackmod - on. when i take full offline backup i observe that more number of archive logs are backed up on logical node 0. But the less logs are getting backed up on logical nodes 1,2. So when i drop the database those logs are lost. when i restore the database and...
10
6854
by: Michael Hoffmann | last post by:
Hello, I hope this doesn't come across as totally newbieish, but I've been searching the web and the IBM docs until smoke is coming out of my head. Scenario: We are trying to take primitive "snapshots" of our production database into a test environment by taking (what we thought are) offline backups of production, then doing a redirected restore into test. Here's the steps I do:
0
9489
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10162
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9959
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5396
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4061
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3665
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.