473,394 Members | 2,090 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,394 software developers and data experts.

How to add a new record into the table?

I want to add a new record (i.e. new vendor) into the
table. I have tried using the Insert Command but it
doesn't insert the record into the SQL table. Or is there
any other ways to add a new record? Below are the codes
that I have typed in.

--- Codes ---

cmdInsert.CommandText = "Insert INTO " _
& "tblVendors(VendorID)" _
& "VALUES(@VendorID)"
cmdInsert.Parameters.Add("@VendorID", SqlDbType.Int, 4,
txtVendorID.Text)

Nov 21 '05 #1
3 1109
Probably a dumb question - but did you call cmInsert.ExecuteNonQuery() after
adding the parameters?

Imran.

"Neuxs" <an*******@discussions.microsoft.com> wrote in message
news:3f****************************@phx.gbl...
I want to add a new record (i.e. new vendor) into the
table. I have tried using the Insert Command but it
doesn't insert the record into the SQL table. Or is there
any other ways to add a new record? Below are the codes
that I have typed in.

--- Codes ---

cmdInsert.CommandText = "Insert INTO " _
& "tblVendors(VendorID)" _
& "VALUES(@VendorID)"
cmdInsert.Parameters.Add("@VendorID", SqlDbType.Int, 4,
txtVendorID.Text)

Nov 21 '05 #2
If I use ExecuteNonQuery, I would need to have a connection string to the
server right? I'm currently using the OleDbDataAdpater and
OleDbDataConnection to make my connection...
"Imran Koradia" wrote:
Probably a dumb question - but did you call cmInsert.ExecuteNonQuery() after
adding the parameters?

Imran.

"Neuxs" <an*******@discussions.microsoft.com> wrote in message
news:3f****************************@phx.gbl...
I want to add a new record (i.e. new vendor) into the
table. I have tried using the Insert Command but it
doesn't insert the record into the SQL table. Or is there
any other ways to add a new record? Below are the codes
that I have typed in.

--- Codes ---

cmdInsert.CommandText = "Insert INTO " _
& "tblVendors(VendorID)" _
& "VALUES(@VendorID)"
cmdInsert.Parameters.Add("@VendorID", SqlDbType.Int, 4,
txtVendorID.Text)


Nov 21 '05 #3

"Nexus" <Ne***@discussions.microsoft.com> wrote in message
news:74**********************************@microsof t.com...
If I use ExecuteNonQuery, I would need to have a connection string to the
server right? I'm currently using the OleDbDataAdpater and
OleDbDataConnection to make my connection...


Don't you already have a connection with a connection string? You shouldn't
need the OleDbDataAdapter just to insert data into the database. You just
need to call cmdInsert.ExecuteNonQuery.

Imran.
Nov 21 '05 #4

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

Similar topics

17
by: Rick | last post by:
Hi all, Is there a MySQL function to get the first record through a query? I would like to open a page of client records with the first one shown. The other records can be accessed from a...
6
by: Hari Om | last post by:
Here are the details of my error log files: I execute the command and get following message at console: ---------------------------------------------------------------------- ../sqlldr...
3
by: Steven Stewart | last post by:
Hi there, I have posted about this before, but yet to arrive at a solution. I am going to try to explain this better. I have an Employees table and a Datarecords table (one-to-many...
5
by: Ross A. Finlayson | last post by:
Hi, I'm scratching together an Access database. The development box is Office 95, the deployment box Office 2003. So anyways I am griping about forms and global variables. Say for example...
19
by: davidgordon | last post by:
Hi, I need some pointers/help on how to do the following if it possible: In my access db, I have the following: Tables: Products, Sub-Assembly, Product-Pack Table, Products
0
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a...
6
by: AA Arens | last post by:
Hi, I have a database with 2 main forms. Contacts and companies. I share the base with two others via LAN. On the companies form I have buttons to navigate throught the records (>400). We are...
5
by: Bill | last post by:
This database has no forms. I am viewing an Access table in datasheet view. I'd like to execute a macro to execute a function (using "runcode"). In the function, I'll reading data from the record...
7
by: john | last post by:
In my form I have a master table and a details table linked 1xM. I can search through the whole parent table but I also like to be able to search through the child table fields to find parent...
3
by: CourtGuy | last post by:
Hi Folks, I've got a problem that's been confounding me for months. I work for a criminal court, and I'm trying to set up an Access database to track petitions filed by criminal defendants. ...
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: 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
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?
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...
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...

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.