[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

Parameter Error when using ODBC

sunny076

5/5/2005 5:12:00 PM

Hi,

I am having a puzzling problem with ODBC connection. I am trying to
insert into Access database.I got this error when I run my code "ERROR
[07002] [Microsoft][ODBC Microsoft Access Driver] Too few parameters.
Expected 2." I took the same insert command and used in Access directly
and the insert was successful. I don't understand why I got the error.

The code I used is below:

OdbcCommand cmd = conn.CreateCommand();
cmd.CommandText = "INSERT INTO [Cust] ([FirstName], [EmpID]) VALUES
(@FirstName, @EmpID)"
string[] mappedValue ={"Sunny", 12};
for(int i =0; i<paramNameList.Length; i++){
OdbcParameter pm = new OdbcParameter(paramNameList[i], odbcType,
colMD.ColumnSize);
cmd.Parameters.Add(pm);
cmd.Parameters[i].Value=mappedValue[i];
}
cmd.ExecuteNonQuery();

Thank you in advance,

Sunny

4 Answers

Paul Clement

5/6/2005 2:43:00 PM

0

On 5 May 2005 10:11:53 -0700, sunny076@yahoo.com wrote:

&#164; Hi,
&#164;
&#164; I am having a puzzling problem with ODBC connection. I am trying to
&#164; insert into Access database.I got this error when I run my code "ERROR
&#164; [07002] [Microsoft][ODBC Microsoft Access Driver] Too few parameters.
&#164; Expected 2." I took the same insert command and used in Access directly
&#164; and the insert was successful. I don''t understand why I got the error.
&#164;
&#164; The code I used is below:
&#164;
&#164; OdbcCommand cmd = conn.CreateCommand();
&#164; cmd.CommandText = "INSERT INTO [Cust] ([FirstName], [EmpID]) VALUES
&#164; (@FirstName, @EmpID)"
&#164; string[] mappedValue ={"Sunny", 12};
&#164; for(int i =0; i<paramNameList.Length; i++){
&#164; OdbcParameter pm = new OdbcParameter(paramNameList[i], odbcType,
&#164; colMD.ColumnSize);
&#164; cmd.Parameters.Add(pm);
&#164; cmd.Parameters[i].Value=mappedValue[i];
&#164; }
&#164; cmd.ExecuteNonQuery();
&#164;

Microsoft recommends that you use Jet OLEDB instead of the Microsoft ODBC driver for stability and
support reasons.

I can''t spot any error in the above code, unless the code to add your parameters is not executing.


Paul
~~~~
Microsoft MVP (Visual Basic)

David Richerby

8/18/2008 11:12:00 AM

0

Guest <none@example.none> wrote:
> "Simon Krahnke" <overlord@gmx.li> wrote:
>> I guess he can't do that because all he has is the web interface
>> that doesn't allow for position setup and analyzing.
>
> I think it's likely that he has a private interface that doesn't get
> compiled into the public version.
>
> To set up positions, run test scripts, etc.
>
> Otherwise, it'd be too hard to do development and basic testing.

Ha ha ha! Obviously, any well-written chess program would have such
an interface. But to try to make inferences about GC from what
well-written programs do is like trying to [insert simile here].

> Personally I have no problem with you trying to figure out a way to
> set up positions in GC, but you know how Sanny got the last time
> somebody even joked at looking at it with a debugger etc.

I have a huge problem with it. There are so many other things that
Simon could do with his time, many of them enjoyable, many of them
worthwhile, many of them even both.


Dave.

--
David Richerby Simple Peanut (TM): it's like a
www.chiark.greenend.org.uk/~davidr/ roasted nut but it has no moving
parts!

Guest

8/18/2008 1:59:00 PM

0

"David Richerby" <davidr@chiark.greenend.org.uk> wrote in message
news:h3m*bzLks@news.chiark.greenend.org.uk...
> Guest <none@example.none> wrote:
>> "Simon Krahnke" <overlord@gmx.li> wrote:
>>> I guess he can't do that because all he has is the web interface
>>> that doesn't allow for position setup and analyzing.
>>
>> I think it's likely that he has a private interface that doesn't get
>> compiled into the public version.
>>
>> To set up positions, run test scripts, etc.
>>
>> Otherwise, it'd be too hard to do development and basic testing.
>
> Ha ha ha! Obviously, any well-written chess program would have such
> an interface. But to try to make inferences about GC from what
> well-written programs do is like trying to [insert simile here].

You need that kind of interface just to set up a position and see if the
move generator is working. To see if all the moves are being gnereated
when an enpassant or promotion is possible, and so on.

A way to dump debugging information, such as list of the ply 1 moves &
scores during the search.

Or to see what squares are being attacked by what piece, etc.

A lot of simple kind of stuff that you can't do from within a gui.

Even Sanny's program had to have (at least in the beginning) a way to do
various testing stuff.


>> Personally I have no problem with you trying to figure out a way to
>> set up positions in GC, but you know how Sanny got the last time
>> somebody even joked at looking at it with a debugger etc.
>
> I have a huge problem with it. There are so many other things that
> Simon could do with his time, many of them enjoyable, many of them
> worthwhile, many of them even both.
>
>
> Dave.
>
> --
> David Richerby Simple Peanut (TM): it's
> like a
> www.chiark.greenend.org.uk/~davidr/ roasted nut but it has no
> moving
> parts!
>




----== Posted via Pronews.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.p... The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= - Total Privacy via Encryption =---

Guest

8/18/2008 2:12:00 PM

0

"Simon Krahnke" <overlord@gmx.li> wrote in message
news:87fxp3q7wf.fsf@xts.gnuu.de...
>* Guest <none@example.none> (21:57) schrieb:
>
>> And there is absolutely no way you could know if somebody actually
>> disassembled it. It could have happened dozens of times just yesterday
>> and
>> you'd never know.
>
> Well, he could look at his webserver log and find my wgets on his
> class and image files.

No way to differentiate them from a web browser (unless you told wget to use
a specific browser ID). Even so, that could just be a web site sucker.
Like you might try if you wanted to be able to get a local copy so you could
try to play it while offline.


>> Just be glad nobody actually cares enough about GC chess to actually want
>> to
>> do anything with it other than satisify their own curosity and set up
>> some
>> positions.
>>
>> If you've ever actually reverse engineered a program, you'd know how hard
>> it
>> is and you'd realize that nobody is going to waste their time doing that
>> with GC chess. (People would rather mess with Rybka etc. Successful
>> programs.)
>
> Reverse engineering an non-obfuscated Java program like Sanny's is
> probably at lot easier than trying that on Rybka 3.

Probably. but to me, reverse engineering is a lot more than simple
disassembly with a few comments.

It means actually understanding what the code does. The data structures and
algorithms being used.

Far enough where you could actually write comparable high level code with
descriptive comments such as "Update the attack squares and check for a pin
then a fork, in that order." and "We'll do part of ABC first because if
it's better than Epsilon then we wont have to do the rest of DEF
becuase...."

It's a very tedious task.

And I don't think anybody in here actually wants to understand GCChess that
well....


>> The people in here aren't planning on doing anything bad. Just be glad
>> some
>> people are actually curious about your program and accept it.
>
> Yeah, the code is funny. It's a wonder that such crappy programming
> actually plays something like chess.
>
> They use Java to teach object oriented programming. Getclub consists of
> two classes. If Java would force the use of classes at some points there
> would probably be zero classes. I so far couldn't find a trace of OOP.

Chess does not OOP well.

It just doesn't break down well into resonable objects. You end up forcing
it and its never a comfortable fit.

You can put stuff into classes, of course, but you can't reasonably OOP it.


> If you find Getclub starting slow, that might be because it loads one

I've never played GC. Don't intend to, either.

What little interest I have in this is curosity about what kind of
algorithms he used, and annoyance that he refuses to do any sort of
reasonable testing to determine its strength; prefering instead to make up
numbers.

I have no interest in playing it.


> class file, another class file ..., one image, another image ... It
> could all be packaged in a single jar file, but the programmer probably
> doesn't know about that.
>
> The sever side seems to be done in PHP. One idiot, two idiot programming
> languages. ;->
>
> mfg, simon .... l




----== Posted via Pronews.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.p... The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= - Total Privacy via Encryption =---