473,603 Members | 2,635 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ODBC Parameter Error

I am getting an error: ERROR [07002] [Microsoft][ODBC Microsoft Access
Driver] Too few parameters. Expected 1 with the following code:

public static string GetTitle(int CatID)
{
OdbcConnection conn = new
OdbcConnection( ConfigurationSe ttings.AppSetti ngs["ConnString "]);
OdbcCommand command = new OdbcCommand("SE LECT Category FROM Categories
WHERE CategoryID = @CID", conn);
conn.Open();
command.Paramet ers.Add(new OdbcParameter(" @CID", OdbcType.Int));
command.Paramet ers["@CID"].Value = CatID;
OdbcDataReader reader =
command.Execute Reader(CommandB ehavior.CloseCo nnection);
reader.Read();
string s = Convert.ToStrin g(reader["Category"]);
conn.Close();
return s;
}

I have to use a DSN and the ODBC Connection. Is it a problem with my
parameter?

Thanks,
Marty


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #1
0 1145

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

Similar topics

2
13633
by: GitarJake | last post by:
Hello all, I am trying to test an ODBC connection to an Oracle dbf using the ODBC Data Source Administrator. It's not working and I suspect I haven't configured Oracle correctly. Below is the error message I am getting: Invalid attribute in connection string: Description.ORA-12514: TNS:listener could not resolve SERVICE_NAME given in connect descriptor
4
7228
by: Roger Redford | last post by:
Dear Experts, I'm attempting to marry a system to an Oracle 817 datbase. Oracle is my specialty, the back end mainly, so I don't know much about java or javascript. The system uses javascript to make ODBC calls to the db. The particular system I'm working with, will not work with an Oracle stored procedure I'm told. However, it
4
18039
by: dcarson | last post by:
I've read about this error in several other discussions, but still can't seem to pinpoint the problem with my code. Everything seemed to be working fine for some time, but it now tends to bomb out on me for some reason. The Summary field is pulled from a Rich Text Editor that allows HTML formatting and appears to be the culprit, but I just can't seem to figure out why. Any guidance is greatly appreciated. I'm connecting to an Access...
5
6172
by: Todd Huish | last post by:
I have noticed something disturbing when retrieving datasets over a relatively slow line (multiple T1). I am looking at about 25 seconds to retrieve 500 rows via a php-odbc link. This same select from the cli is for all intents practicaly instantaneous. After much research I discovered that PHP by default uses a dynamic cursor type which can be quite a bit slower than a forward only cursor. BTW I have been searching forward only/read...
2
1902
by: Bibi | last post by:
Hi, i have a SqlWindows Program which made a connection to a MS Access Database about ODBC. I can get all datas with a select about one table. But when i made a select with more than one table, i get the following message: "ACCESS:-3010 1 Parameter wurden erwartet, aber es wurden zu wenig Parameter übergeben." Can somebody help me ?
1
1635
by: TheKval | last post by:
I'm trying to pull records on a Macola table linked to Access. If enter a value in the criteria field of the query form, the quer executes okay. If I change the criteria to a parameter, ala, , I get the ODBC... call failed error. The data ite is a 3 character text field. I've tried to us the parameter AFTE trimming the table field. no luck Any helpful hints? :
0
1748
by: Marco Martin | last post by:
Hi group, I have an app that accesses an Access DB. We are using odbc because this app will probably be using other databases as well dependiing on the clients needs. Consider the following; OdbcParameter prmID = new OdbcParameter("ID", OdbcType.Text);//ID column is Primary Key
3
4588
by: juststarter | last post by:
Hello all, I am executing a stored procedure (on an SQL Server) using ODBC but i can't get the output parameter's value on the client. The stored proc has 3 parameters ,2 of them are input and 1 is output. (for shake of simplicity let's suppose that the proc seems something like -------------------------------------------------------------------- alter storedProcsName @inputParam1 varchar(20), @inputParam2 varchar(20), @outputParam...
1
10308
by: chloe.crowder | last post by:
Hi We're trying to use call a stored procedure to update information in a remote Ingres database. We've linked the server, and can read information using SELECT * FROM OPENQUERY (..........), but we can't find a suitable syntax for executing a procedure. Using SELECT * FROM OPENQUERY and passing the EXEC statement in a string gives a message about not returning any columns - not surprising as there aren't any, and trying to execute...
4
10068
by: Szymon Dembek | last post by:
Hi Recently I did some DB2 and ODBC coding in Visual FoxPro. I bumped on a problem I cannot resolve. When I issue a delete statement that deletes no rows (no rows qualify for the WHERE conditions), DB2 raises SQL0100W warning with SQLSTATE=02000. The same happens when issuing an insert with select clause (insert into .... select from ...) when no rows are fetched by the select clause.
0
7928
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8415
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
8405
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...
0
8273
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
6735
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
5441
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
3951
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1514
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1259
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.