How To Submit Query Required Data Without User Prompt Using Mixed Oledb Source And Substrings In Vb Code ? 追蹤

0
Avatar
Legacy Poster

For several years for three clients (Bartender Automation 9.10) I have developed a windows service that prints the labels by making raw data collection through stored-procedures on SQL Server database, and after (vb.net code) using the "Format.SubStrings("xxxx").Value = xxx" to populate the label with data. Now I have a new customer and a new BarTender 10.1 Automation. The client first used the software EasyCode and wants, even with Bartender create the label through direct connection to the database so can see immediately the label (during the editing) over to check if it's ok. I used as a data source fields in a SQL table and I created a small query with a prompt to enter a "product code" for data searching. I also assigned a name to the product text  that I use in the service program as a substring. When print the label the value of the substring that i assign in code is ignored, and I see (Print.Message) that the query is running but with key research ='' (no record found) and Result=2. How do I programmatically connect to OLE DB source and compile the query by assigning the value of search ?
 
Fulvio
 

3 意見

0
Avatar
Ian Cummings
版主
評論操作 永久連結

Are you trying to set the query prompt value in the document in order to return a record set for printing?  If so do this like the below examples:

 

// Set a QueryPrompt to use the default reply, using its index.
queryprompts[0].Value = queryprompts[0].DefaultReply;

// Set a QueryPrompt's value using its name (case sensitive).
queryprompts["QueryPrompt1"].Value = "New Value";

// Or do the same as the above line with the SetQueryPrompt method.
queryprompts.SetQueryPrompt("QueryPrompt1", "New Value", "New Default Reply", "New User Prompt");

0
Avatar
Legacy Poster
評論操作 永久連結

Yes.. I tried it and it works but for some fields (not all) my application must be able to override the values returned from the integrated label query with other values returned from stored-procedure and I don't know if is possible and how to make it (named substring ?).

 

Thanks

0
Avatar
Legacy Poster
評論操作 永久連結

Perhaps it might be useful to change 'on the fly' the selection of data:

 

btFormat.Databases.GetDatabase(1).OLEDB.SQLStatement = NewSQLString
 

 

but I do not know if this is possible in your case.

It's worth a try.

登入寫評論。