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.parameters.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 3887
Try this:
Dim t1 as String = varname+ "0000"
Dim cmdstr as string ="Select Name, Addr from " + t1 + " where Name = ?"
cmdstr.parameters.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********@yahoo.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.parameters.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.parameters.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****@easylift.org> wrote in message
news:eF**************@TK2MSFTNGP10.phx.gbl... Try this:
Dim t1 as String = varname+ "0000" Dim cmdstr as string ="Select Name, Addr from " + t1 + " where Name = ?" cmdstr.parameters.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********@yahoo.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.parameters.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.parameters.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********@yahoo.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.parameters.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********@yahoo.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.parameters.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********@yahoo.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.parameters.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**********@ntlworld.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
Hi Herfried,
My apologies, I thought I'd already talked about it here, but I did a search and nothing came up. Now I remember it was in a
totally different forum!!
As I mentioned, I don't know German, but love the sound of it. So sometimes in my pretend German I make up words using an
English root and German prefixes and suffixes.
Wenn Sie "gebloaten" sind, es ist nicht <voll> und es ist nicht <sehr voll>. Nein, es ist "ooooooh, Ich habe viel zu viel
gegessen." voll. :-)
From the English "bloated" - which I imagine after 20 Big Macs, you would have been, lol.
From another (unsent) reply:
|| > No, I mean some <different> fun! ;-D
||
|| We visited all 20 McDonalds's restaurants
That's certainly different. :-)
What was the purpose? Did you eat at each one, like in a pub crawl?
Regards,
Fergus
And this has relevance to a 'Tough SQl Query'?
"Fergus Cooney" <fi******@tesco.net> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... Hi Herfried,
My apologies, I thought I'd already talked about it here, but I did a
search and nothing came up. Now I remember it was in a totally different forum!!
As I mentioned, I don't know German, but love the sound of it. So
sometimes in my pretend German I make up words using an English root and German prefixes and suffixes.
Wenn Sie "gebloaten" sind, es ist nicht <voll> und es ist nicht <sehr
voll>. Nein, es ist "ooooooh, Ich habe viel zu viel gegessen." voll. :-)
From the English "bloated" - which I imagine after 20 Big Macs, you
would have been, lol.
From another (unsent) reply: || > No, I mean some <different> fun! ;-D || || We visited all 20 McDonalds's restaurants
That's certainly different. :-)
What was the purpose? Did you eat at each one, like in a pub crawl?
Regards, Fergus
Obviously not. Does it need to have?
Seeing as this is a newsgroup about the VB.Net language and the thread is
about 'Tough SQL Query' then Yes.
"Fergus Cooney" <fi******@tesco.net> wrote in message
news:eC**************@tk2msftngp13.phx.gbl... Obviously not. Does it need to have?
|| Seeing as this is a newsgroup about the
|| VB.Net language and the thread is
|| about 'Tough SQL Query'
Insufficient reason.
Stephany,
Yes this is a newsgroup about a language,
And the people who often contribute in this newsgroup, did add somethimes
extra to this newsgroup.
This gives a better idea why they are writting something in a certain way
and that makes the discussion richer and better understandable for the ones
who contributes a lot.
You can see that too in the discussion about for next and do while.
A Spanish writter tells to an Austrian writter that he should not use those
difficult Englisch words.
After some chat they understand each other.
Herfried, was quick answering messages yesterday.
Now we know he was bloated and could not reach his keyboard with his arms.
Cor
"Stephany Young" <st******@sysoft.co.nz> schrieb And this has relevance to a 'Tough SQl Query'?
They love this kind of discussions. It has it's advantages: After receiving
100 new posts, you can mark 90 of them as "read". ;-))))
--
Armin
Hello,
"Fergus Cooney" <fi******@tesco.net> schrieb: As I mentioned, I don't know German,
You know a lot of German...
but love the sound of it. So sometimes in my pretend German I make up words using an English root and German prefixes and suffixes.
:-)
Wenn Sie "gebloaten" sind, es ist nicht <voll> und es ist nicht <sehr voll>. Nein, es ist "ooooooh, Ich habe viel zu viel gegessen." voll. :-)
Now I understand what you mean.
From the English "bloated" - which I imagine after 20 Big Macs, you would have been, lol.
I didn't eat 20 Big Macs.
From another (unsent) reply: || > No, I mean some <different> fun! ;-D || || We visited all 20 McDonalds's restaurants
That's certainly different. :-)
What was the purpose? Did you eat at each one, like in a pub crawl?
Yes. It doesn't make sense at all, but I meet some good friends.
--
Herfried K. Wagner
MVP · VB Classic, VB.NET http://www.mvps.org/dotnet
Hello,
"Stephany Young" <st******@sysoft.co.nz> schrieb: And this has relevance to a 'Tough SQl Query'?
No, sorry!
--
Herfried K. Wagner
MVP · VB Classic, VB.NET http://www.mvps.org/dotnet
Hello,
"Cor" <no*@non.com> schrieb: Yes this is a newsgroup about a language, And the people who often contribute in this newsgroup, did add somethimes extra to this newsgroup.
I add OT postings too often, I know.
You can see that too in the discussion about for next and do while. A Spanish writter tells to an Austrian writter that he should not use those difficult Englisch words. After some chat they understand each other.
:-)
Herfried, was quick answering messages yesterday. Now we know he was bloated and could not reach his keyboard with his arms.
LOL.
--
Herfried K. Wagner
MVP · VB Classic, VB.NET http://www.mvps.org/dotnet
> I didn't eat 20 Big Macs.
Was it one chip per McDonalds?
--
HTH,
-- Tom Spink, Über Geek
Please respond to the newsgroup,
so all can benefit
"Maybe it's a game called 'Punish the User'"
"Herfried K. Wagner [MVP]" <hi*******@m.activevb.de> wrote in message
news:OV**************@TK2MSFTNGP10.phx.gbl... Hello,
"Fergus Cooney" <fi******@tesco.net> schrieb: As I mentioned, I don't know German,
You know a lot of German...
but love the sound of it. So sometimes in my pretend German I make up words using an English root and German prefixes and suffixes.
:-)
Wenn Sie "gebloaten" sind, es ist nicht <voll> und es ist nicht <sehr voll>. Nein, es ist "ooooooh, Ich habe viel zu viel gegessen." voll. :-)
Now I understand what you mean.
From the English "bloated" - which I imagine after 20 Big Macs, you would have been, lol.
I didn't eat 20 Big Macs.
From another (unsent) reply: || > No, I mean some <different> fun! ;-D || || We visited all 20 McDonalds's restaurants
That's certainly different. :-)
What was the purpose? Did you eat at each one, like in a pub crawl?
Yes. It doesn't make sense at all, but I meet some good friends.
-- Herfried K. Wagner MVP · VB Classic, VB.NET http://www.mvps.org/dotnet
Hi Cor,
|| Herfried, was quick answering messages yesterday.
|| Now we know he was bloated and could not reach
|| his keyboard with his arms
ROFLMAO
Cheers,
Fergus
Hi Herfried,
|| "Stephany Young" <st******@sysoft.co.nz> schrieb:
|| > And this has relevance to a 'Tough SQl Query'?
||
|| No, sorry!
Don't be a wimp. It's not good for you.
It also contradicts other statements that you have made regarding OT.
This makes you look as if you're ready to leap left or right whenever
someone demands.
Regards,
Fergus
ps. I don't want an apology about your apology, either. Sit up straight, stick
your chest out and hold your head high!
;-)
Hi Herfried,
|| You know a lot of German...
Sort of.
This helps: http://www.freetranslation.com/
|| I didn't eat 20 Big Macs.
I'm glad of that!! :-)
|| Yes. It doesn't make sense at all, but I meet some good friends.
It makes (almost) perfect sense - you met up with some good friends. :-D
I did a bit of a lookup on Austria. Total population less than the
residential population of London - let alone the working population. Ah, the
freedom, the space!!
Regards,
Fergus
Which of course is where we get
Mein Hovercraft ist voll von Aalen
Charles
"Fergus Cooney" <fi******@tesco.net> wrote in message
news:Oj**************@TK2MSFTNGP11.phx.gbl... Hi Herfried,
|| You know a lot of German...
Sort of. This helps: http://www.freetranslation.com/
|| I didn't eat 20 Big Macs.
I'm glad of that!! :-)
|| Yes. It doesn't make sense at all, but I meet some good friends.
It makes (almost) perfect sense - you met up with some good friends.
:-D I did a bit of a lookup on Austria. Total population less than the residential population of London - let alone the working population. Ah,
the freedom, the space!!
Regards, Fergus
Hi Charles,
|| Mein Hovercraft ist voll von Aalen
My hovercraft is full of eels ??
I know that eels are a particular delicacy in Aalen, Austria*, but where
does the hovercraft bit come from?
Regards,
Fergus
* Believe that, you'll believe anything. :-)
Ah, c'est Monsieur le Python. From the book with dirty fingerprints.
Charles
"Fergus Cooney" <fi******@tesco.net> wrote in message
news:ev**************@TK2MSFTNGP09.phx.gbl... Hi Charles,
|| Mein Hovercraft ist voll von Aalen
My hovercraft is full of eels ??
I know that eels are a particular delicacy in Aalen, Austria*, but
where does the hovercraft bit come from?
Regards, Fergus
* Believe that, you'll believe anything. :-)
Hi Charles,
Ah. Yes. Nick (Nak) and I have been into the Monty bit. I never got it the
first time round so I remain much in ignorance to this day. But now that I
know you're a Montyite I shall be on the lookout for things that make me go
"duh?? ".
;-)
Regards,
Fergus 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 ...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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"...
|
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. ...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
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...
|
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,...
|
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...
| |