473,386 Members | 1,793 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 During Runtime But New Data Does Not Appear in Data Tables

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 = 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 1054

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

Similar topics

14
by: L Mehl | last post by:
I tested a FE/BE application developed in A2000 on a A2002 machine and got this message when exiting the app. Clicking the only available button "OK", exits the application, as intended. The FE...
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...
2
by: William Herring | last post by:
I would like to set up a zope/database interface (using Postgres 7.4) with the following properties: - multiple users each with their own id and password - accessed via zope - they will enter and...
29
by: MP | last post by:
Greets, context: vb6/ado/.mdb/jet 4.0 (no access)/sql beginning learner, first database, planning stages (I think the underlying question here is whether to normalize or not to normalize this...
12
by: John Baker | last post by:
Hi: I have read a number of threads on the issue of compressing (compacting) Access data bases programmatically, and have been left confused. We are using Access 2000, and I need code that will...
7
by: Susan Mackay | last post by:
I have a data table that is connected to a database table with a data adapter in the 'standard' manner. However I want to be able to remove selected rows from the data table (i.e. no longer...
0
by: dakvanslam | last post by:
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...
2
by: rustyc | last post by:
Well, here's my first post in this forum (other than saying 'HI' over in the hi forum ;-) As I said over there: ... for a little side project at home, I'm writing a ham radio web site in...
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...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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...
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
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...
0
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...

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.