Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Database and Reporting > changing the command text of a command that has been grouped


Reply
 
Thread Tools Display Modes
  #1  
Old 07-25-2003, 10:20 AM
scarlet13 scarlet13 is offline
Newcomer
 
Join Date: Jul 2003
Posts: 4
Question changing the command text of a command that has been grouped


Hi, I am a newbie to all of this and was wondering if someone could help me with a problem I am having. I am trying to dynamically change the command text for a data environment command that has been grouped. For some reason what I have tried does not work. Here is what I have tried:

I have a data environment with a command called command1 that is grouped. The grouped name is command1_grouped. The grouped command has the following fields: Summary fields has MealName. Detail Fields has MealName and IngrediantName.

I have created a data report that is grouped by the meal name and then lists the ingrediants for that meal. This works fine. However, I would like the user to be able to imput a list of meals and then get a print out. This requires me to build the command text dynamically. But when I try the following I get errors.

DataEnvironment1.Commands("Command1_Grouping").CommandText = (NEW SQL STATEMENT GOES HERE).

DataEnvironment1.Connection1.Execute DataEnvironment1.Commands("Command1_Grouping").CommandText


When I run this I get an error telling me that Command1.IngrediantName cannot be found(this occurs when I try to open the data report). If I ungroup the command and then change the command name back to its original name it works fine, except I can no longer use the group heading in my data report. I.E. DataEnvironment1.Commands("Command1").CommandText = (NEW SQL STATEMENT GOES HERE).

It wont let me use the original command name if it is grouped. In other words if I tried the code above while the command was still grouped I get an invalid procedure or argument error.

As you can probably tell I am at a complete loss here and would really appreciate anyones help

Thanks,
scarlet13
Reply With Quote
  #2  
Old 07-25-2003, 12:05 PM
scarlet13 scarlet13 is offline
Newcomer
 
Join Date: Jul 2003
Posts: 4
Smile

Never mind, I figured out an easier way to do this using paramaters in my SQL statements.

Thanks anyway,
scarlet13
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
 
 
-->