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

Working with a DataBase VB.Net

Ok I looked around and could not fing what I was looking for (probably cant get keywords right) and so I will post. Please forgive me if this has been answered a billion times.

Using VB.net Framework, XP, and Access

I created a database in access I want to use a form from VB.net to Either add to or edit that database. (The form is finished)

So on button click I want it to search the databse for a # if that number exists then create a new line in the database copying all the infomation from the form into the proper cells. If not simply update the existing infomation in the appropriate cells in the same line that that # was found.

Like the last time I posted I dont want to be told exactly how to write the code just a little direction.

Example

thiscall()
' opens the database
thatcall()
' searches the database
thesecalls()
' copies the entries from the form to the database


Once I know the posible calls, etc to make I can probably figure out the rest.

Any Direction is greatly appreciated

Thanks
James
Dec 11 '07 #1
4 1659
vanc
211 Expert 100+
So on button click I want it to search the database for a # if that number exists then create a new line in the database copying all the information from the form into the proper cells. If not simply update the existing information in the appropriate cells in the same line that that # was found.
1. Create a select query to get out the row that has needed #
2a. If the return value is empty then run a query to insert an new row into database
2b. If the needed # is existed in database then just make an update query to update the row with that #

Expand|Select|Wrap|Line Numbers
  1. select query = "Select * From <table> Where <table>.# = <input #>"
  2. OledbDataReader reader = OledbCommand.ExecuteReader()
  3. If(reader.HasRow)
  4. update query = "Update <table> Set ........."
  5. else
  6. insert query = "Insert into <table> Values(..........)"
  7.  
cheers.
Dec 12 '07 #2
1. Create a select query to get out the row that has needed #
2a. If the return value is empty then run a query to insert an new row into database
2b. If the needed # is existed in database then just make an update query to update the row with that #

Expand|Select|Wrap|Line Numbers
  1. select query = "Select * From <table> Where <table>.# = <input #>"
  2. OledbDataReader reader = OledbCommand.ExecuteReader()
  3. If(reader.HasRow)
  4. update query = "Update <table> Set ........."
  5. else
  6. insert query = "Insert into <table> Values(..........)"
  7.  
cheers.

Thanks but
ummm a little more for Dummies still fairly new to VB
Dec 12 '07 #3
Shashi Sadasivan
1,435 Expert 1GB
Are you still looking for a Dummies vesion for the VB .Net code provided there..
or the incomplete SQL query?

The vb .net code is pretty much all that you would need (woulld need to add a connection string to it)
For SQL check for some online tutorials...
Dec 12 '07 #4
Are you still looking for a Dummies vesion for the VB .Net code provided there..
or the incomplete SQL query?

The vb .net code is pretty much all that you would need (woulld need to add a connection string to it)
For SQL check for some online tutorials...
Oh sorrry forgot to post that i figured it out yesterday tyvm though.
Dec 13 '07 #5

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

Similar topics

3
by: Chris Tilley - HPC:Factor | last post by:
Hi, I'm utterly confounded by this one. There must be some sort of rule that I don't know of. I'd consider myself a Newbie+1, so be gentle. I have a database connection (working A-Ok) and a...
5
by: Andrew DeFaria | last post by:
I created the following .sql file to demonstrate a problem I'm having. According to the manual: If |ON DELETE CASCADE| is specified, and a row in the parent table is deleted, then InnoDB...
2
by: RC | last post by:
I am updating/improving a working database for a non-profit organization. I am thinking of making a copy of the database at the office, bringing the copy to my house, making the changes and then...
0
by: Viorel | last post by:
Working as a beginner with data objects in Visual Studio 2003 and C#, I use the "Generate Dataset" command in order to generate automatically the dataset objects based on data adapters. Generated...
2
by: Nikhil Patel | last post by:
Hi all, I installed an asp.net application on a client's machine on Friday. It uses a Sql Server database as backend. Database server and Web server are on different machines but same domain. The...
14
by: Mark B | last post by:
Our webhost (www.usbusinessweb.net) had a W2K IIS5 server crash after a scheduled hard-boot occurred during a ms-security patch install overnight. They couldn't get the server working again so they...
3
by: Jason Huang | last post by:
Hi, In our C# Windows Form application, we are using the SQL Server 2000 as the database server. The Database table MyTable has a field RegistrationDate which represents the Date a client comes...
7
by: vamichael | last post by:
When I try to run the Website Administration Tool from my published application using http://localhost/myapp/webadmin.axd I am getting a "resource not found" error message. I can use the...
22
by: Bob and Sharon Hiller | last post by:
I have an ASP page that was done in VBScript It is setup to read an Access database and I need to change it to read a Sql 2005 Database. The code that is used to open the Access Database: Set...
2
by: Sheikko | last post by:
ADO.NET - Working with DataSet ========================= HI, I want to create an application that interact with a DB. I wont to use SQL statement, but I want to use DataSet. - I have created my...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...

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.