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

undefined Sqlcommand

33
i hv done the correction as i was directed here but the Sqlcommand is still not defined. is still underlined with red. Below is the code again. pls i need help.
the particular SqlComand is on bold.

Expand|Select|Wrap|Line Numbers
  1. Dim Objconn As New SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirector      y|\chiscoTransport.mdb;Integrated Security=True;Connect Timeout=30;User Instance=True")
  2.         Objconn.Open()
  3.  
  4.         Dim ObjCmd As SqlCommand = 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)
  5.  
  6.  
  7.         ObjCmd.Parameters.Add("@vehicleID", Data.SqlDbType.VarChar).Value = vehicleIDComboBox.Text
  8.         ObjCmd.Parameters.Add("@pname", Data.SqlDbType.Text).Value = pnameTextBox.Text
  9.         ObjCmd.Parameters.Add("@deptureT", Data.SqlDbType.Text).Value = deptureTComboBox.Text
  10.         ObjCmd.Parameters.Add("@trvllingft", Data.SqlDbType.Text).Value = trvllingftComboBox.Text
  11.         ObjCmd.Parameters.Add("@pssngerAD", Data.SqlDbType.Text).Value = pssngerADTextBox.Text
  12.         ObjCmd.Parameters.Add("@phoneNo", Data.SqlDbType.Int).Value = phoneNoTextBox.Text
  13.         ObjCmd.Parameters.Add("@fare", Data.SqlDbType.Int).Value = fareTextBox.Text
  14.         ObjCmd.Parameters.Add("@time", Data.SqlDbType.Text).Value = timeTextBox.Text
  15.         ObjCmd.Parameters.Add("@exptdjd", Data.SqlDbType.Text).Value = exptdjdTextBox.Text
  16.         ObjCmd.Parameters.Add("@date", Data.SqlDbType.Text).Value = dateTextBox.Text
  17.  
  18.  
  19.         ObjCmd.ExecuteNonQuery()
  20.  
  21.  
  22.         Objconn.Close()
Jul 25 '07 #1
2 1242
RoninZA
78
Aren't you supposed to write Dim ObjCmd as New SqlCommand(...)?
Jul 25 '07 #2
Plater
7,872 Expert 4TB
Aren't you supposed to write Dim ObjCmd as New SqlCommand(...)?
You also need the namespace "SqlClient." since you are using it in-line instead of as an import (or whatever it's called in vb)
Jul 25 '07 #3

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

Similar topics

2
by: Guinness Mann | last post by:
Greetings, I asked this question over on the ADO.NET newsgroup and couldn't scrape up an answer. I realize that it is more of an ADO question than an SQL Server question, but I'm hoping there...
10
by: Henrik Dahl | last post by:
Hello! After I've finished using an instance of the SqlCommand class, should I then invoke Dispose() on the instance. I suppose so, as there is a Dispose method, but what does it actually...
2
by: Jim Owen | last post by:
The following code does not operate properly, and neither I nor the three ..Net experts can figure out why. It's a seeming mystery. The code is simple. A SqlCommand is executed against a stored...
1
by: Tom | last post by:
Hello guys Please have a look on following paragraph from ".NET Data Access Architecture Guide". ''''''''''' Although you can repeatedly use the same SqlCommand object to execute the same...
3
by: Jason Huang | last post by:
Hi, In C#.Net, can we have more than one SqlCommand in a SqlConnection? And in one SqlCommand, can we have more than one SqlDataReader in a SqlCommand? In what situation should I use...
0
by: Agnes | last post by:
I got a silly question about Sqlcommand . In my form, there are 5 methods which use the same sqlcommand to execute reader. I had create and dispose for each sqlcommand in every method. Some said...
1
by: job | last post by:
how is it possible to serialize/de-serialize a SqlCommand?
2
by: menyki | last post by:
below is a code to input data from vb.net to ms access. in the code SqlCommand is underlined and the error msg is that, is not defined. can somebody tell me how i can define it Dim Objconn As New...
0
by: menyki | last post by:
i hv done the correction as i was directed here but the Sqlcommand is still not defined. is still underlined with red. Below is the code again. pls i need help. the particular SqlComand is on bold....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: 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...
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...

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.