473,326 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

SQl Question with VB .NET

Hi

I<m wrting a SQL string in my VB .NET application.

There is a function in my string but it<n not seem working
I have always an syntax error message

this is my quesry
strSQL = "INSERT INTO Tb_client( IDclient, c1CommUOM )" _
& " SELECT Tb_Temp.COMPFILE, " & getAbbrUM( "[TYPE1]" ) & " AS
c1CommUOM FROM Tb_Temp"

Where Type1 is a string in the Table Tb_Temp

Any idea who can I use a function in a SQl Query in a VB .NEt code

Thanks

Jul 21 '05 #1
6 1203

"Hermione" <He******@discussions.microsoft.com> wrote in message
news:47**********************************@microsof t.com...
Hi

I<m wrting a SQL string in my VB .NET application.

There is a function in my string but it<n not seem working
I have always an syntax error message

this is my quesry
strSQL = "INSERT INTO Tb_client( IDclient, c1CommUOM )" _
& " SELECT Tb_Temp.COMPFILE, " & getAbbrUM( "[TYPE1]" ) & " AS
c1CommUOM FROM Tb_Temp"

Where Type1 is a string in the Table Tb_Temp

Any idea who can I use a function in a SQl Query in a VB .NEt code

Thanks


What do you want your function to do? Do you want to calculate something
from a column called TYPE1?
What database do you use?

/Fredrik
Jul 21 '05 #2
Hi Fredrik
Thank for your answer

YEs acctually I want to calculate some value regardingthe Type1, and I
already programed the function getAbbrUM.

If you have any idea it<ll be great
"Fredrik Wahlgren" wrote:

"Hermione" <He******@discussions.microsoft.com> wrote in message
news:47**********************************@microsof t.com...
Hi

I<m wrting a SQL string in my VB .NET application.

There is a function in my string but it<n not seem working
I have always an syntax error message

this is my quesry
strSQL = "INSERT INTO Tb_client( IDclient, c1CommUOM )" _
& " SELECT Tb_Temp.COMPFILE, " & getAbbrUM( "[TYPE1]" ) & " AS
c1CommUOM FROM Tb_Temp"

Where Type1 is a string in the Table Tb_Temp

Any idea who can I use a function in a SQl Query in a VB .NEt code

Thanks


What do you want your function to do? Do you want to calculate something
from a column called TYPE1?
What database do you use?

/Fredrik

Jul 21 '05 #3

"Hermione" <He******@discussions.microsoft.com> wrote in message
news:C2**********************************@microsof t.com...
Hi Fredrik
Thank for your answer

YEs acctually I want to calculate some value regardingthe Type1, and I
already programed the function getAbbrUM.

If you have any idea it<ll be great

I cab think of 3 ways, I'm not sure about the last one

1) If you use something like Oracle or SQL Server, you need to create a
stored procedure where you define getAbbrUM.

2) Get the values from the mentioned column and loop over them, calling
getAbbrUM on each row

3) Maybe ADO.NET has some kind of built-in functionality that makes this
easier than looping. I think you should ask the ...public.framework.adonet
newsgroup.

/Fredrik
Jul 21 '05 #4
Hello Hermione,

your query cannot call the method GetAbbrUM. You need to create the SQL
statement, send it to SQL Server or whatever database you are using, get
back the results (which will come back as one or more rows), then loop
through the results. In each result, you can extract the field and perform
the calculation.

All you are doing, in the statement below, is passing in the string
"[TYPE1]" to your function... which is probably not what you want.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Hermione" <He******@discussions.microsoft.com> wrote in message
news:47**********************************@microsof t.com...
Hi

I<m wrting a SQL string in my VB .NET application.

There is a function in my string but it<n not seem working
I have always an syntax error message

this is my quesry
strSQL = "INSERT INTO Tb_client( IDclient, c1CommUOM )" _
& " SELECT Tb_Temp.COMPFILE, " & getAbbrUM( "[TYPE1]" ) & " AS
c1CommUOM FROM Tb_Temp"

Where Type1 is a string in the Table Tb_Temp

Any idea who can I use a function in a SQl Query in a VB .NEt code

Thanks

Jul 21 '05 #5
thanks Nick

"Nick Malik [Microsoft]" wrote:
Hello Hermione,

your query cannot call the method GetAbbrUM. You need to create the SQL
statement, send it to SQL Server or whatever database you are using, get
back the results (which will come back as one or more rows), then loop
through the results. In each result, you can extract the field and perform
the calculation.

All you are doing, in the statement below, is passing in the string
"[TYPE1]" to your function... which is probably not what you want.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"Hermione" <He******@discussions.microsoft.com> wrote in message
news:47**********************************@microsof t.com...
Hi

I<m wrting a SQL string in my VB .NET application.

There is a function in my string but it<n not seem working
I have always an syntax error message

this is my quesry
strSQL = "INSERT INTO Tb_client( IDclient, c1CommUOM )" _
& " SELECT Tb_Temp.COMPFILE, " & getAbbrUM( "[TYPE1]" ) & " AS
c1CommUOM FROM Tb_Temp"

Where Type1 is a string in the Table Tb_Temp

Any idea who can I use a function in a SQl Query in a VB .NEt code

Thanks


Jul 21 '05 #6
thanks Fredrik

"Fredrik Wahlgren" wrote:

"Hermione" <He******@discussions.microsoft.com> wrote in message
news:C2**********************************@microsof t.com...
Hi Fredrik
Thank for your answer

YEs acctually I want to calculate some value regardingthe Type1, and I
already programed the function getAbbrUM.

If you have any idea it<ll be great

I cab think of 3 ways, I'm not sure about the last one

1) If you use something like Oracle or SQL Server, you need to create a
stored procedure where you define getAbbrUM.

2) Get the values from the mentioned column and loop over them, calling
getAbbrUM on each row

3) Maybe ADO.NET has some kind of built-in functionality that makes this
easier than looping. I think you should ask the ...public.framework.adonet
newsgroup.

/Fredrik

Jul 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Madhusudan Singh | last post by:
Hi After months of waiting for Redhat to come out with up to date rpms, I decided to compile a working OpenSSL/ MySQL / PHP / httpd installation for myself. Installed the latest versions of...
0
by: Alexander Skwar | last post by:
Hello! I'm having problems getting PHP 4.3.3RC4 successfully to install on my HP-UX 11.00 server. After a (successfull?) compile, "make install" errors out with this error message: ...
7
by: Darren Gamble | last post by:
Good day, I've sent a message on this to the php-general list already, but unfortunately no one replied. Sorry for the repost. to those that read both... I'm having a problem working with an...
7
by: kecebong | last post by:
I tried to compile php 4.3.3 with gd but it doesn't work, it wasnt show in phpinfo(). My system is redhat 9 and apache 2.0.47 webserver.
0
by: Slavik | last post by:
All libraries were installed (precompiled) This is FreeBSD 5.1 installed zlib, installed jpeg and png libraries (in default directories) GD 2.0.11 source is in /usr/gd-2.0.11 (compiled and...
3
by: Garrett Albright | last post by:
Trying to compile PHP 5 beta 4, and not having much fun... % ./configure --with-apxs --with-mod_charset --with-zlib --with-bz2 --with-curl --with-gd --with-mhash --with-pspell...
0
by: LRW | last post by:
(Not even sure if that's the right way to word the question.) We're trying to migrate to a new server, and upgrade the PHP on the new server in the process. We're using a RedHat Enterprise Server...
9
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
3
by: Ron King | last post by:
When I installed Mandrake 10.0 I thought I had Apache, PHP, and MySQL installed correctly. I could serve web pages, MySQL worked, and when I tried the phpinfo() function, I got a page that looked...
13
by: Gary Quiring | last post by:
I need to create an XML string using PHP5. The examples I have followed seem to be using out dated libary calls. I tried new_xmldoc() and new DomDocument. Both get undefined errors. How do I...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.