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

OleDbCommand Selecting Variable Data

-Dim cmd As OleDbCommand
-cmd = New OleDbCommand("select * from qmsstats where firstname='jason'",
OleDbConnection1)
-OleDbDataAdapter2.SelectCommand = cmd
-DataGrid1.Visible = True
-OleDbDataAdapter2.Fill(DsQmsStats1)
-DataGrid1.DataBind()

In the above example I need to change 'jason' to a variable. I need the
variable to be pulled from a textbox. IE: txtusername.text. Please advise how
I can get the value from txtusername.text in place of 'jason'.

Thanks, Jason Steeves
Jul 22 '05 #1
1 1848
Jason Steeves wrote:
-Dim cmd As OleDbCommand
-cmd = New OleDbCommand("select * from qmsstats where
firstname='jason'", OleDbConnection1)
-OleDbDataAdapter2.SelectCommand = cmd
-DataGrid1.Visible = True
-OleDbDataAdapter2.Fill(DsQmsStats1)
-DataGrid1.DataBind()

In the above example I need to change 'jason' to a variable. I need
the variable to be pulled from a textbox. IE: txtusername.text.
Please advise how I can get the value from txtusername.text in place
of 'jason'.


There was no way for you to know it, but this is a classic asp newsgroup.
While you may be lucky enough to find a dotnet-savvy person here who can
answer your question, you can eliminate the luck factor by posting your
question to a newsgroup where the dotnet-savvy people hang out. I suggest
microsoft.public.dotnet.framework.aspnet.

You need to use a parameter marker, "?", and use the OleDbCommand's
parameters collection to pass the value from the textbox to the parameter
marker. If you have Visual Studio, you can look these concepts up in online
help. If not, go to msdn.microsoft.com/library and search for "parameter
queries" or "parameter markers"

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 22 '05 #2

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

Similar topics

5
by: Axial | last post by:
Question: How to select columns from Excel-generated XML when some cells are empty. I've found examples where rows are to be selected, but I can't seem to extrapolate from that to selecting...
0
by: Kim | last post by:
Hello, I am selecting data from a text file in the following format: INSERT INTO SELECT * FROM " & sSource & " IN '' " & _ "'text;Database=" & sPath & ";FMT=Delimited;HDR=No' " & _ "WHERE =...
1
by: Brian | last post by:
Was browsing around online for code to connect to a database usign ADO and C#... and i found this very simple but useful reference (http://www.c-sharpcorner.com/database/db_list.asp) However,...
0
by: Tom Wild | last post by:
Hi I am creating a webform in VB.Net which connects to an Access database. I can get the webform to connect to the database fine and also to download data but when I try and update the...
0
by: Jason Steeves | last post by:
-Dim cmd As OleDbCommand -cmd = New OleDbCommand("select * from qmsstats where firstname='jason'", OleDbConnection1) -OleDbDataAdapter2.SelectCommand = cmd -DataGrid1.Visible = True...
0
by: RG | last post by:
OleDbCommand.Prepare error: Size of parameter (VB.NET 2003) I need to do a SQL INSERT statement into an Access table, and I’d like to use the exact technique described in the Help file example...
4
by: Agnes | last post by:
Dim authConnection As New OleDbConnection("Provider = VfpOleDB.1;Data Source = d:\cgl\vfpmaster\ttsdata\tts.dbc") authConnection.Open() Dim authCommand As String = "select loginid from coinfo...
2
by: larry | last post by:
I am working on a DB for family data, and in this application the data spans variable amount of rows in multiple tables (one for the adults data, one for "family", one for the kids, another for...
5
by: hollyquinn | last post by:
Hi I am working with a web application where I am selecting values from a SQL Server 2005 database and then loading the values into different controls on my page. Most of the values load with no...
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: 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...
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,...
0
jinu1996
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
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,...

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.