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

Write Back To SQL from ASP .NET web Page

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.
Nov 21 '05 #1
2 1514
On Thu, 4 Nov 2004 08:09:05 -0800, rr****@800mcmahan.com
<rr*****************@discussions.microsoft.com> wrote:

¤ 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 ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Nov 21 '05 #2
Thanks. All set with this. Functioning like a dream.

"Paul Clement" wrote:
On Thu, 4 Nov 2004 08:09:05 -0800, rr****@800mcmahan.com
<rr*****************@discussions.microsoft.com> wrote:

¤ 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 ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)

Nov 21 '05 #3

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

Similar topics

4
by: Belinda | last post by:
Hello All I need to read a SQL Server table into a Web Page and within the Web Page to permit my users to make changes to the records, delete or add new records and then save the entire contents...
6
by: Mike Daniel | last post by:
I am attempting to use document.write(pageVar) that displays a new html page within a pop-up window and the popup is failing. Also note that pageVar is a complete HTML page containing other java...
2
by: Ralph Krausse | last post by:
I want to create my own kind of counter, for myself. I have a resume page on my site. I want to know how many people go there but dont want to 'go there' myself because I don't want to increase the...
4
by: Richard | last post by:
Hello, I'm dynamically writing out a web page using response.write. The page has images and hyperlinks (each hyperlink points back to the same page, but with a different parameter which...
4
by: etropic | last post by:
Im confused I want an .aspx page to have a table with my data in it. At first I wrote FillTablew(); in my Page_Load even in the Code Behind file. I had it loop the db etc. and use Response.Write...
11
by: Russ | last post by:
My web app writes some binary data to a file at the client site via Response.Write and Response.BinaryWrite. This action is accomplished in response to a button click, with C# code behind as...
2
by: Khnumtemu | last post by:
Hello all, I am trying to change a line of text when a user uses the back button to return to a page what I have at the moment is this: <script> if(window.location == window.location){ ...
1
by: anupamaavadutha | last post by:
hi all, iam new to javascript. i have problem calling javascript functions.iam designing a calender page.here is my code. <%@ page...
1
by: localp | last post by:
the code found below is in a javascript file. what i am trying to do is to write a document to a page and submit it ( or to inplement a back ) .. for this i want to create a button .. when i wrote...
3
by: sriram347 | last post by:
Hi I am a newbie to ASP.NET. I developed a web page (project type is web application) and I keep getting this error. B]Error message : "System.AccessViolation Exception attempted to read or...
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: 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:
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...
0
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...
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...
0
Oralloy
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 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.