Bind combobox to sql statement result in VB2005

G

guy

I am able to use the Server Explorer to create a dataset containing tables in my database. I am able
to bind a table to my combobox and set a filter by including a where clause. But I am unable to
concat 2 columns as an addition column in the select statement without getting an error. It seems
that I am restricted to use only the columns of the table.

How do I bind a combobox to the resultset of a SQL statement?

Furthermore, I need to sync the contents of a datagrid from the selectedvalue of the combobox. Any
ideas?
 
R

RobinS

Post your code (like your query at least), and we may be able to help you.

Robin S.
 
G

guy

Post your code (like your query at least), and we may be able to help you.

Robin S.
The problem has to do with visual programming so the only code is SQL. I tracked down to the Query
Builder in TableAdapter Config. It seems that the sql parser only recognizes the plus sign (+) as a
string concatenation operator but this is not portable to other RDBMS that use the ANSI SQL standard
vertical bars "||" string concatenation operator.

The following ANSI SQL is not accepted by the TableAdapter Query Builder parser although the
statement executes properly:

select sColumn1 || sColumn2 as expr1 from mytable;

The following SQL works in SQL Server but it is not portable to other RDBMS:
select sColumn1 + sColumn2 as expr1 from mytable;
 
A

aaron.kempf

huh?

Im really not sure i've seen that before.. is that mySql?

I mean do you really think that is ANSI?

-Aaron
 
A

aaron.kempf

and for the record; you can always make a 'calculated column' in SQL
Server

so you could call this sColumns and set the formula for this to
sColumn1 + sColumn2
and then you could bind the crap to the single column

I love calculated columns; I don't think that very many other vendors
support this; but I use them ALL the friggin time
 
R

RobinS

Okay, now I know what you're talking about. I feel your pain. I used Oracle
in my last app, which uses the ||. But why do you need to use that if you
are using SQLServer in the background? Or does the strongly typed dataset
stuff not recognize when the database is non-SQLServer and allow you to do
different syntax?

Robin S.
--------------------------
 
G

guy

Okay, now I know what you're talking about. I feel your pain. I used Oracle
in my last app, which uses the ||. But why do you need to use that if you
are using SQLServer in the background? Or does the strongly typed dataset
stuff not recognize when the database is non-SQLServer and allow you to do
different syntax?

Robin S.

I need to stick with portable code so using the plus sign (+) for concatenation in SQL is not an
option. What is the work around in VB2005?
 
R

RobinS

guy said:
I need to stick with portable code so using the plus sign (+) for
concatenation in SQL is not an
option. What is the work around in VB2005?

It looks like you're SOL. From what I can find, that is the only
concatenation symbol in SQLServer. You could try posting your question to
microsoft.public.sqlserver.programming and see if they have any other
ideas.

Robin S.
 
A

aaron.kempf

maybe you could write a function and call it ||

Select FirstName + dbo.|| + LastName

ROFLMAO
 
A

aaron.kempf

'I need to use portbale code' so can you please make SQL Server work
like this Oracle _CRAP_

Oracle is obsolete dog.. check out www.olapreport.com

if you're not usign Olap you're shit outta luck and you're roadkill

OLAP solves every database performance problem in the world
 
A

aaron.kempf

'this is not portable to other RDBMS'

please give examples.. are you only referring to Oracle?

Oracle hasn't been competitive for 5 years www.olapreport.com/market.htm

Oracle has less than 5% marketshare dog; don't bitch about making SQL
act like Oracle dude.. Oracle is for ****ing retards that are stuck in
the 90s
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top