Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Database and Reporting > changing query in command


Reply
 
Thread Tools Display Modes
  #1  
Old 05-13-2002, 05:58 AM
sysa sysa is offline
Regular
 
Join Date: Apr 2002
Location: Malaysia
Posts: 58
Default changing query in command


hi,,

i have created a command under my dateEnvironment connection. the command has a sql query. please tell me how to change that sql query at runtime or how to use parameters with that query.

thanx.
Reply With Quote
  #2  
Old 05-13-2002, 11:22 AM
anhmytran anhmytran is offline
Senior Contributor

Retired Moderator
* Guru *
 
Join Date: Aug 1999
Location: Hartford, Connecticut, 06
Posts: 1,487
Wink Please, have your code shown

Without your code, it is difficult to help.
By the way, what does the word "command" mean?
Reply With Quote
  #3  
Old 05-13-2002, 12:07 PM
Cogen's Avatar
Cogen Cogen is offline
Contributor
 
Join Date: Apr 2002
Location: Ontario, Canada
Posts: 673
Default

Are you wanting to change the SQL query, or do you just want a parameter added to it? If you want to change it, then it might be better just to add an additional command object.

I'm not going to go into full detail on how to have a parameter in an SQL query, but here is a start ...

... in your SQL query, use the "?" key to identify a parameter
example ...
SELECT * FROM AccountLog WHERE StudentID = ?

... you mentioned that your using a dataenvironment, so click on the properties of the specific command object your talking about, and you will need to set the parameter properties on the parameters tab.

... when you call the command object, pass the parameter with it
example ... desomething.command_obectname parameter_value

Well, I hope that help a little at least.
Reply With Quote
  #4  
Old 05-13-2002, 10:06 PM
sysa sysa is offline
Regular
 
Join Date: Apr 2002
Location: Malaysia
Posts: 58
Default

ah! man this forum is great.
Thanks cogen. i did what you said and its working fine now.

anhmytran, by the word command i meant the Command that you create under a dataEnvironment where u can write SQL queries and can use that command to get a resultset.

w'll be back soon..
Reply With Quote
  #5  
Old 05-14-2002, 01:41 AM
Cogen's Avatar
Cogen Cogen is offline
Contributor
 
Join Date: Apr 2002
Location: Ontario, Canada
Posts: 673
Default

I would have to agree with you ... this is a great forum.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->