My SQL string is kind of wierd one.
In my application, I need to select things from an
unknown name table. But I know the table name before the
SQL command is executed.
For instance,
Dim varname as string = 'one of my variable. It's part of
the table name.
Dim t1 as String = varname+ "0000"
Dim cmdstr as string ="Select Name, Addr from t1 where
Name = ?"
cmdstr.paramete rs.add("Name", odbctype(char), 50)
I use a string concaticate method and got error.
"Cannot find table t1".
Can some one tell me how to do that ? 28 3909
Try this:
Dim t1 as String = varname+ "0000"
Dim cmdstr as string ="Select Name, Addr from " + t1 + " where Name = ?"
cmdstr.paramete rs.add("Name", odbctype(char), 50)
I'm still new at .NET syntax, so the concats may have to occur in their own
line.
You could also do a .replace on the string.
"Arial" <Ar********@yah oo.com> wrote in message
news:2b******** *************** *****@phx.gbl.. . My SQL string is kind of wierd one. In my application, I need to select things from an unknown name table. But I know the table name before the SQL command is executed.
For instance, Dim varname as string = 'one of my variable. It's part of the table name.
Dim t1 as String = varname+ "0000" Dim cmdstr as string ="Select Name, Addr from t1 where Name = ?" cmdstr.paramete rs.add("Name", odbctype(char), 50)
I use a string concaticate method and got error. "Cannot find table t1".
Can some one tell me how to do that ?
Use the & operator for concatenating strings:
Dim t1 As String = strVarName & "0000"
Dim cmdstrAs String = "SELECT Name, Addr FROM " & t1 & " WHERE Name = ?"
Also, what does this line cmdstr.paramete rs.add("Name", odbctype(char), 50)
do?
The String object has no such property/method.
--
HTH,
-- Tom Spink, Über Geek
Please respond to the newsgroup,
so all can benefit
"Maybe it's a game called 'Punish the User'"
"Richard Brown" <rb****@easylif t.org> wrote in message
news:eF******** ******@TK2MSFTN GP10.phx.gbl... Try this:
Dim t1 as String = varname+ "0000" Dim cmdstr as string ="Select Name, Addr from " + t1 + " where Name = ?" cmdstr.paramete rs.add("Name", odbctype(char), 50)
I'm still new at .NET syntax, so the concats may have to occur in their
own line. You could also do a .replace on the string.
"Arial" <Ar********@yah oo.com> wrote in message news:2b******** *************** *****@phx.gbl.. . My SQL string is kind of wierd one. In my application, I need to select things from an unknown name table. But I know the table name before the SQL command is executed.
For instance, Dim varname as string = 'one of my variable. It's part of the table name.
Dim t1 as String = varname+ "0000" Dim cmdstr as string ="Select Name, Addr from t1 where Name = ?" cmdstr.paramete rs.add("Name", odbctype(char), 50)
I use a string concaticate method and got error. "Cannot find table t1".
Can some one tell me how to do that ?
Thanks! it works great!
I owe you one! -----Original Message----- Try this:
Dim t1 as String = varname+ "0000" Dim cmdstr as string ="Select Name, Addr from " + t1
+ " where Name = ?" cmdstr.paramete rs.add("Name", odbctype(char), 50)
I'm still new at .NET syntax, so the concats may have to
occur in their ownline. You could also do a .replace on the string.
"Arial" <Ar********@yah oo.com> wrote in message news:2b******* *************** ******@phx.gbl. .. My SQL string is kind of wierd one. In my application, I need to select things from an unknown name table. But I know the table name before
the SQL command is executed.
For instance, Dim varname as string = 'one of my variable. It's part
of the table name.
Dim t1 as String = varname+ "0000" Dim cmdstr as string ="Select Name, Addr from t1 where Name = ?" cmdstr.paramete rs.add("Name", odbctype(char), 50)
I use a string concaticate method and got error. "Cannot find table t1".
Can some one tell me how to do that ?
.
Hi Herfried,
It was a VB question, lol.
t1 = "TableName"
cmdstr = "Blah blah t1 blah blah"
Q: Why is cmdstr wrong?
A: Oops. I havn't learnt how to concatenate strings!!
Btw, it's the weekend again - go and have some fun. :-)
No, I mean some <different> fun! ;-D
Regards,
Fergus
You should be using & instead of +, I hope.
--
HTH,
-- Tom Spink, Über Geek
Please respond to the newsgroup,
so all can benefit
"Maybe it's a game called 'Punish the User'"
"Arial" <ar********@yah oo.com> wrote in message
news:33******** *************** *****@phx.gbl.. . Thanks! it works great!
I owe you one!
-----Original Message----- Try this:
Dim t1 as String = varname+ "0000" Dim cmdstr as string ="Select Name, Addr from " + t1 + " where Name = ?" cmdstr.paramete rs.add("Name", odbctype(char), 50)
I'm still new at .NET syntax, so the concats may have to occur in their ownline. You could also do a .replace on the string.
"Arial" <Ar********@yah oo.com> wrote in message news:2b******* *************** ******@phx.gbl. .. My SQL string is kind of wierd one. In my application, I need to select things from an unknown name table. But I know the table name before the SQL command is executed.
For instance, Dim varname as string = 'one of my variable. It's part of the table name.
Dim t1 as String = varname+ "0000" Dim cmdstr as string ="Select Name, Addr from t1 where Name = ?" cmdstr.paramete rs.add("Name", odbctype(char), 50)
I use a string concaticate method and got error. "Cannot find table t1".
Can some one tell me how to do that ?
.
Hello,
"Fergus Cooney" <fi******@tesco .net> schrieb: It was a VB question, lol.
t1 = "TableName" cmdstr = "Blah blah t1 blah blah"
Q: Why is cmdstr wrong? A: Oops. I havn't learnt how to concatenate strings!!
Btw, it's the weekend again - go and have some fun. :-)
No, I mean some <different> fun! ;-D
Today (yesterday) I was on "Mac Styria Tour" with some friends. We visited
all 20 McDonals's restaurants in our district (Styria).
;-)))
--
Herfried K. Wagner
MVP · VB Classic, VB.NET http://www.mvps.org/dotnet
Hello,
"Tom Spink" <th**********@n tlworld.com> schrieb: You should be using & instead of +, I hope.
Mega-LOL.
--
Herfried K. Wagner
MVP · VB Classic, VB.NET http://www.mvps.org/dotnet
Hi Herfried,
ROFL.
Und jetzt sind Sie gebloaten, ja?
Regards,
Fergus
Hello,
"Fergus Cooney" <fi******@tesco .net> schrieb: ROFL.
Und jetzt sind Sie gebloaten, ja?
What do you mean by "gebloaten" ?
--
Herfried K. Wagner
MVP · VB Classic, VB.NET http://www.mvps.org/dotnet This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: leegold2 |
last post by:
Let's I do a mysql query and then I do a,
for( $i = 1; $row = mysql_fetch_array($result); $i++ ) {...}
and it gives me this:
PageID Title URL Description
1 lee's gogle1.com This is lee's website.
1 lee's gogle2.com This is lee's website.
2 Jon's yaho1.com This is Jon's website.
2 Jon's yaho2.com This is Jon's website.
|
by: Roman |
last post by:
I've been trying this one for 2-3 hours and can't figure it out. I'de
appreciate any help or pointers in the right direction. Thanks.
Query
I need the query to return me all the lottery names and results that
have the latest date in the database for that particular game and for
the state . So the return data from the data below data would be:
Result:
--------------------------
|
by: Sy Borg |
last post by:
Hello:
We are designing two multi-user client server applications that
performs large number of transactions on database servers. On an
average Application A has a 50% mix of select and update/insert/delete
statements and application B has 80-20 mix of select and
update/insert/delete statements. Being able to scale the databases as
needed so the performance is unaffected, is one of our critical
requirements. We've been investigating...
|
by: greg |
last post by:
Hi
Basically I call a page that does a very long op
(like very long database query)
and display results (possible on another page)
But I need to display a progress bar
for user to see some progress (dummy but at least something)
no frames
|
by: Bill Bob |
last post by:
I am going mad with this Query. I need to join 3 Tables. Their Formats
are
Vouchers
NOT NULL ,
NOT NULL ,
NULL ,
NOT NULL ,
(255)
CONSTRAINT PRIMARY KEY CLUSTERED
| |
by: Dan |
last post by:
I am trying to create a query (in either sql or the design view) to
determine which two (or more I suppose if it's not too complicated)
baseball players were teammates the longest. The database includes the
following fields: YearId, PlayerId, and teamId.
I have been unable to write query that can caluclate the number of
years players would have played together on a team. (Technical note:
some players have records for more than one team...
|
by: DFS |
last post by:
The following data set is building inspection visits. It consists of
multiple visits (2+) made to the same building on the same day.
I want to get a list of visits made to the same building on the same day,
but by different employees, and for different visit codes (eg records 5-6,
or 9-11)
Here's the table
=====================================
|
by: steven.fafel |
last post by:
I am running 2 versions of a correlated subquery. The two version
differ slightly in design but differ tremendously in performance....if
anyone can answer this, you would be awesome.
The "bad" query attempts to build a result set using a correlated
subquery. The part causing the error is that the correlated subquery
is part of a derived table (joining 3 tables). Trying to run the query
takes a long time and the more records in the...
|
by: jconstan |
last post by:
hey all,
i am having a problem with a certain query which pulls records from two tables. one table contains info entered into a main form, and the other has information entered into the subform.
what i want the query to pull is all the records from the main table, and only the most recent record (IE latest date inputed into "date" field) from the sub table.
however what ends up happening is the query will pull all the records from...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |