473,386 Members | 1,654 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,386 software developers and data experts.

Database updates (using SqlDataAdapter) during runtime but Database Table Does Not Update

I apologize if this is a simple question, but I am very new to SQL
Server. I feel like I am missing something easy here. I an running VB
..NET from Visual Studio 2005 and SQL Server Express. The code in
question is as follows:

ChosenProjectName = TextBox2.Text

Dim NewProject As New DataSet

OpenConn()

Dim GetProjectList As String = "SELECT * FROM Approved_Projects ORDER
BY Project_ID DESC"
Dim GetProjectsAdapter As SqlDataAdapter = New
SqlDataAdapter(GetProjectList, MainCon)

Dim myDataSet As DataSet = New DataSet()
Dim myDataRow As DataRow
GetProjectsAdapter.Fill(myDataSet, "Approved_Projects")

Dim LastProjectID As Integer =
myDataSet.Tables("Approved_Projects").Rows(0)("Pro ject_ID")

myDataRow = myDataSet.Tables("Approved_Projects").NewRow
myDataRow("Project_Name") = ChosenProjectName
myDataRow("Project_Status_ID") = 1
myDataRow("Project_Box_State_ID") = 1
myDataRow("Project_ID") = LastProjectID + 1

myDataSet.Tables("Approved_Projects").Rows.Add(myD ataRow)

Dim myDataRowsCommandBuilder As SqlCommandBuilder = New
SqlCommandBuilder(GetProjectsAdapter)

GetProjectsAdapter.Update(myDataSet, "Approved_Projects")

GetProjectsAdapter.Dispose()
myDataSet.Dispose()
CloseConn()

In short, I am attempting to read data from a table of approved
projects (named Approved_Projects) into a dataset, add a record, return
that data through the SqlDataAdapter to my database.

Here is my question: after this piece of code runs in my program, I can
reopen the connection to my database, query the data for Projects and
my new record shows up fine. BUT when I go to the Server Explorer in
Visual Studio to look at the new Table Data in "Approved_Projects", the
new data isn't there AND when I rerun the application, the new record
is absent. What am I missing here?

Any help will be greatly appreciated.

Dirk

Nov 21 '06 #1
0 1380

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

Similar topics

4
by: Frnak McKenney | last post by:
I'm using an in-core DataSet as an image of my application's 'database' (a multi-table Access97 mdb file). Updates are made to the DataTables within the DataSet via forms with bound TextBoxes,...
3
by: Tc | last post by:
Hi, I was curious, I am thinking of writing an application that loads a dataset from a database that resides on a server. The question I have is this, if multiple copies of the app will be...
3
by: .Net Newbie | last post by:
I'm new to .Net and need to create a generic (free) way to update lookup tables in SQL Server (using C#) in ASP.Net pages. I found an article at:...
4
by: RSH | last post by:
Hi, I have a situation where I have created a little application that makes an Access database from a SQL Database for reporting purposes. it does the job well, but it seems a bit slow. Is...
0
by: dakvanslam | last post by:
I am new to VB .NET and SQL Server, so I apologize if this is a basic question. I am using Visual Studio 2005 with SQL Server Express. Below is the code in question: ChosenProjectName =...
16
by: fniles | last post by:
I am using VB.NET 2003, SQL 2000, and SqlDataAdapter. For every record in tblA where colB = 'abc', I want to update the value in colA. In VB6, using ADO I can loop thru the recordset,set the...
4
by: dgleeson3 | last post by:
Hello all I am creating a VB.Net distributed SQL server 2005 application. Each computer in the system has a database with a table of users and their telephone numbers. Each computer has a...
1
by: gomathinayagam | last post by:
hai, am only beginer in c#... i am trying to connect database with webform. using a technique that the fields of the table and the controls in a form are named same...then i try get the controls...
3
by: sachinkale123 | last post by:
I am using SQL Adapter to select data from a table in SQL Server Database. After creating Object I am filling that to a datatable. Assum that dataset has 5 row. After that I m updating that dataset...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.