473,748 Members | 10,028 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

vfp oledbcommand [Fail]

Dim authConnection As New OleDbConnection ("Provider =
VfpOleDB.1;Data Source = d:\cgl\vfpmaste r\ttsdata\tts.d bc")
authConnection. Open()
Dim authCommand As String = "select loginid from coinfo
where loginid = @cocode "

oleCommand.Para meters.Add("@co code", OleDbType.VarCh ar,
10).Value = "1001"
or oleCommand.Para meters.Add(new oledbparameter( "@cocode",
OleDbType.VarCh ar, 10)).Value = "1001"
Dim drRv As OleDbDataReader =
oleCommand.Exec uteReader <---ERROR

Please help, I don't know what's wrong with my statment.
For the same syntax, I can run very well in my sql server,
However, When I change into oleddb command.
I got "missing operand" error.

Aug 28 '06 #1
4 2436
Agnes,

What is the meaning from this boolean code that you are using?

oleCommand.Para meters.Add("@co code", OleDbType.VarCh ar,
10).Value = "1001"
or oleCommand.Para meters.Add(new oledbparameter( "@cocode",
OleDbType.VarCh ar, 10)).Value = "1001"
In my idea does it nothing

Cor

"Agnes" <ag***@dynamict ech.com.hkschre ef in bericht
news:uA******** ******@TK2MSFTN GP04.phx.gbl...
Dim authConnection As New OleDbConnection ("Provider =
VfpOleDB.1;Data Source = d:\cgl\vfpmaste r\ttsdata\tts.d bc")
authConnection. Open()
Dim authCommand As String = "select loginid from coinfo
where loginid = @cocode "

oleCommand.Para meters.Add("@co code", OleDbType.VarCh ar,
10).Value = "1001"
or oleCommand.Para meters.Add(new oledbparameter( "@cocode",
OleDbType.VarCh ar, 10)).Value = "1001"
Dim drRv As OleDbDataReader =
oleCommand.Exec uteReader <---ERROR

Please help, I don't know what's wrong with my statment.
For the same syntax, I can run very well in my sql server,
However, When I change into oleddb command.
I got "missing operand" error.



Aug 29 '06 #2
I want to pass the company code '1001' as parameter to the command text.

"Cor Ligthert [MVP]" <no************ @planet.nl¼¶¼g© ó¶l¥ó·s»D:%2*** *************@T K2MSFTNGP05.phx .gbl...
Agnes,

What is the meaning from this boolean code that you are using?

oleCommand.Para meters.Add("@co code", OleDbType.VarCh ar,
10).Value = "1001"
or oleCommand.Para meters.Add(new oledbparameter( "@cocode",
OleDbType.VarCh ar, 10)).Value = "1001"
In my idea does it nothing

Cor

"Agnes" <ag***@dynamict ech.com.hkschre ef in bericht
news:uA******** ******@TK2MSFTN GP04.phx.gbl...
> Dim authConnection As New OleDbConnection ("Provider =
VfpOleDB.1;Dat a Source = d:\cgl\vfpmaste r\ttsdata\tts.d bc")
authConnection. Open()
Dim authCommand As String = "select loginid from coinfo
where loginid = @cocode "

oleCommand.Para meters.Add("@co code", OleDbType.VarCh ar,
10).Value = "1001"
or oleCommand.Para meters.Add(new oledbparameter( "@cocode",
OleDbType.VarC har, 10)).Value = "1001"
Dim drRv As OleDbDataReader =
oleCommand.Exe cuteReader <---ERROR

Please help, I don't know what's wrong with my statment.
For the same syntax, I can run very well in my sql server,
However, When I change into oleddb command.
I got "missing operand" error.




Aug 29 '06 #3
Brrrrrrrrr

That or is in your message is no code but a seperator of two possibilities.

An error that mostly is done by OleDB is that there are added to many times
a paramaeter.

If you add it than you add it to an array, that array it is using. Therefore
you should only add them one time and than change the value as often as you
want.

Have a look at this page how to use OleDB parameters.

http://www.vb-tips.com/dbpages.aspx?...3-eb8b44af0137

I hope this helps,

Cor
"Agnes" <ag***@dynamict ech.com.hkschre ef in bericht
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
>I want to pass the company code '1001' as parameter to the command text.

"Cor Ligthert [MVP]" <no************ @planet.nl>
¼¶¼g©ó¶l¥ó·s»D: %2************* ***@TK2MSFTNGP0 5.phx.gbl...
>Agnes,

What is the meaning from this boolean code that you are using?

oleCommand.Para meters.Add("@co code", OleDbType.VarCh ar,
10).Value = "1001"
or oleCommand.Para meters.Add(new oledbparameter( "@cocode",
OleDbType.VarC har, 10)).Value = "1001"
In my idea does it nothing

Cor

"Agnes" <ag***@dynamict ech.com.hkschre ef in bericht
news:uA******* *******@TK2MSFT NGP04.phx.gbl.. .
>> Dim authConnection As New OleDbConnection ("Provider =
VfpOleDB.1;Da ta Source = d:\cgl\vfpmaste r\ttsdata\tts.d bc")
authConnection. Open()
Dim authCommand As String = "select loginid from coinfo
where loginid = @cocode "

oleCommand.Para meters.Add("@co code", OleDbType.VarCh ar,
10).Value = "1001"
or oleCommand.Para meters.Add(new oledbparameter( "@cocode",
OleDbType.Var Char, 10)).Value = "1001"
Dim drRv As OleDbDataReader =
oleCommand.Ex ecuteReader <---ERROR

Please help, I don't know what's wrong with my statment.
For the same syntax, I can run very well in my sql server,
However, When I change into oleddb command.
I got "missing operand" error.





Aug 29 '06 #4
Hi Agnes,

"@" preceding a variable name has a different use in FoxPro than it does in
SQL Server. This works for me:

Try

Dim cn1 As New OleDbConnection ( _
"Provider=VFPOL EDB.1;Data Source=C:\Temp\ ;")
cn1.Open()
'-- Make some VFP data to play with
Dim cmd1 As New OleDbCommand( _
"Create Table TestParameter (Field1 C(10))", cn1)
Dim cmd2 As New OleDbCommand( _
"Insert Into TestParameter Values ('Hello')", cn1)
Dim cmd3 As New OleDbCommand( _
"Insert Into TestParameter Values ('World')", cn1)
cmd1.ExecuteNon Query()
cmd2.ExecuteNon Query()
cmd3.ExecuteNon Query()

Dim cmd4 As New OleDbCommand( _
"Select * From TestParameter Where Field1 = ?", cn1)
Dim p1 As New OleDbParameter( "Field1", "World")
Dim da1 As New OleDbDataAdapte r(cmd4)
Dim ds1 As New DataSet
Dim dr1 As DataRow

cmd4.Parameters .Add(p1)
da1.Fill(ds1)
For Each dr1 In ds1.Tables(0).R ows
Console.WriteLi ne(dr1.Item(0). ToString())
Next
Console.ReadLin e()
cn1.Close()

Catch e As Exception
MsgBox(e.ToStri ng())
End Try

--
Cindy Winegarden MCSD, Microsoft Most Valuable Professional
ci***@cindywine garden.com
"Agnes" <ag***@dynamict ech.com.hkwrote in message
news:uA******** ******@TK2MSFTN GP04.phx.gbl...
Dim authConnection As New OleDbConnection ("Provider =
VfpOleDB.1;Data Source = d:\cgl\vfpmaste r\ttsdata\tts.d bc")
authConnection. Open()
Dim authCommand As String = "select loginid from coinfo
where loginid = @cocode "

oleCommand.Para meters.Add("@co code", OleDbType.VarCh ar,
10).Value = "1001"
or oleCommand.Para meters.Add(new oledbparameter( "@cocode",
OleDbType.VarCh ar, 10)).Value = "1001"
Dim drRv As OleDbDataReader =
oleCommand.Exec uteReader <---ERROR

Please help, I don't know what's wrong with my statment.
For the same syntax, I can run very well in my sql server,
However, When I change into oleddb command.
I got "missing operand" error.



Aug 29 '06 #5

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

Similar topics

1
1879
by: Jason Steeves | last post by:
-Dim cmd As OleDbCommand -cmd = New OleDbCommand("select * from qmsstats where firstname='jason'", OleDbConnection1) -OleDbDataAdapter2.SelectCommand = cmd -DataGrid1.Visible = True -OleDbDataAdapter2.Fill(DsQmsStats1) -DataGrid1.DataBind() In the above example I need to change 'jason' to a variable. I need the variable to be pulled from a textbox. IE: txtusername.text. Please advise how
2
2690
by: Christopher | last post by:
Could Anyone help me! I'm currenly working on an application which involves SQL Statements. And my current problem is that when i execute the SQL statement on MS Access 2003 the Insert Statement performs fine when i'm using OledbCommand to execute it there would be an exception raise "Syntax Error insert into" Why is this so? Here is a code segment where the error occured:
1
3483
by: Brian | last post by:
Was browsing around online for code to connect to a database usign ADO and C#... and i found this very simple but useful reference (http://www.c-sharpcorner.com/database/db_list.asp) However, implementing this into my own project does seem to work. I'm getting an error: 'System.Data.OleDb.OleDbCommand' does not contain a definition for 'Fill' Why would this be?
0
1069
by: Tom Wild | last post by:
Hi I am creating a webform in VB.Net which connects to an Access database. I can get the webform to connect to the database fine and also to download data but when I try and update the database by firing off an OleDBCommand I get the following error: "Problem firing System.Data.OleDb.OleDbCommand - Operation must use an updateable query"
0
9530
Oralloy
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...
0
9363
jinu1996
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...
1
9312
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9238
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8237
agi2029
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...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4593
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...
0
4864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2775
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.