Write Back To SQL from ASP .NET web Page

G

Guest

I'm trying to execute a SQL Insert command using my existing SqlConnection
without refering to a dataset. I've come acroos several examples such as:

Public Sub CreateMySqlCommand(myExecuteQuery As String, myConnection As
SqlConnection)
Dim myCommand As New SqlCommand(myExecuteQuery, myConnection)
myCommand.Connection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()
End Sub 'CreateMySqlCommand

however my project isn't recognizing SqlCommand as a function. Is there a
reference I'm missing or is someone else executing SQL commands straight at
the connection? Please help.
 
P

Paul Clement

On Thu, 4 Nov 2004 08:09:05 -0800, (e-mail address removed)

¤ I'm trying to execute a SQL Insert command using my existing SqlConnection
¤ without refering to a dataset. I've come acroos several examples such as:
¤
¤ Public Sub CreateMySqlCommand(myExecuteQuery As String, myConnection As
¤ SqlConnection)
¤ Dim myCommand As New SqlCommand(myExecuteQuery, myConnection)
¤ myCommand.Connection.Open()
¤ myCommand.ExecuteNonQuery()
¤ myConnection.Close()
¤ End Sub 'CreateMySqlCommand
¤
¤ however my project isn't recognizing SqlCommand as a function. Is there a
¤ reference I'm missing or is someone else executing SQL commands straight at
¤ the connection? Please help.

You need to either fully qualify the namespace or add an Imports statement to your module:

System.Data.SqlClient.SqlCommand

or

Imports System.Data.SqlClient


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top