here is an input code i wrote to input data from the user interface to database in access. error occured when i tried to run the problem. the error messages are as follow.
2. SqlCommand is not defined.
( text ) - Private Sub submitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles submitButton.Click
-
Dim Objconn As New SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector y|\chiscoTransport.mdb;Integrated Security=True;Connect Timeout=30;User Instance=True")
-
Objconn.Open()
-
-
ObjCmd = New SqlCommand("INSERT INTO seatReservation (vehicleID, pname, deptureT, trvllingft, pssngerAD, phoneNo, fare, time, exptdjd, date) VALUES (@vehicleID, @pname, @deptureT, @trvllingft, @pssngerAD, @phoneNo, @fare, @time, @exptdjd, @date)", Objconn)
-
-
-
ObjCmd.Parameters.Add("@vehicleID", Data.SqlDbType.VarChar).Value = vehicleIDComboBox.Text
-
ObjCmd.Parameters.Add("@pname", Data.SqlDbType.Text).Value = pnameTextBox.Text
-
ObjCmd.Parameters.Add("@deptureT", Data.SqlDbType.Text).Value = deptureTComboBox.Text
-
ObjCmd.Parameters.Add("@trvllingft", Data.SqlDbType.Text).Value = trvllingftComboBox.Text
-
ObjCmd.Parameters.Add("@pssngerAD", Data.SqlDbType.Text).Value = pssngerADTextBox.Text
-
ObjCmd.Parameters.Add("@phoneNo", Data.SqlDbType.Int).Value = phoneNoTextBox.Text
-
ObjCmd.Parameters.Add("@fare", Data.SqlDbType.Int).Value = fareTextBox.Text
-
ObjCmd.Parameters.Add("@time", Data.SqlDbType.Text).Value = timeTextBox.Text
-
ObjCmd.Parameters.Add("@exptdjd", Data.SqlDbType.Text).Value = exptdjdTextBox.Text
-
ObjCmd.Parameters.Add("@date", Data.SqlDbType.Text).Value = dateTextBox.Text
-
-
-
Objbtn.ExecuteNonQuery()
-
-
-
Objconn.Close()
-
End Sub
1 891
Instead of: -
ObjCmd = New SqlCommand(....)
-
try: -
Dim ObjCmd as SqlCommand = new SqlCommand(...)
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: AIM |
last post by:
Error in msvc in building inheritance.obj to build hello.pyd
Hello,
I am trying to build the boost 1.31.0 sample extension hello.cpp.
I can not compile the file inheritance.cpp because the two...
|
by: Gregory |
last post by:
Hi,
One of the disadvantages of using error handling with error codes
instead of exception handling is that error codes retuned from a
function can be forgotten to check thus leading to...
|
by: deko |
last post by:
I use this convention frequently:
Exit_Here:
Exit Sub
HandleErr:
Select Case Err.Number
Case 3163
Resume Next
Case 3376
Resume Next
|
by: p |
last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also
have Crystal 9 pro on my development machine. The web app runs fine on my
dev machine but am having problems deploying....
|
by: hyperpau |
last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding.
I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com).
Ergo, I...
|
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...
|
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
|
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...
|
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...
|
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,...
|
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: 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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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,...
| |