473,414 Members | 1,947 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,414 software developers and data experts.

problem with odbc

This is the code:

OdbcConnection conn = new OdbcConnection(m_ConnectionString);

OdbcDataAdapter adapter = new OdbcDataAdapter();

adapter.SelectCommand = new OdbcCommand("spUser", conn);

OdbcParameter par = new OdbcParameter("@User",OdbcType.VarChar,20);

par.Value=user;

adapter.SelectCommand.Parameters.Add(par);

adapter.Fill(dsUser);

This is the error:

"ERROR [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure
'spUser' expects parameter '@User', which was not supplied."

What is wrong here
Nov 18 '05 #1
1 1292
Try in this way

OdbcConnection conn = new OdbcConnection( m_ConnectionString );
OdbcDataAdapter adapter = new OdbcDataAdapter();
OdbcCommand command = new OdbcCommand();
OdbcParameter par = new OdbcParameter("@User", OdbcType.VarChar, 20 );
par.Value = user;
command.Parameters.Add ( par );
adapter.SelectCommand = command;

adapter.Fill ( dsUser );

Regards
Martin

"TomislaW" <to*********@hotmail.com> wrote in message
news:Oo**************@TK2MSFTNGP09.phx.gbl...
This is the code:

OdbcConnection conn = new OdbcConnection(m_ConnectionString);

OdbcDataAdapter adapter = new OdbcDataAdapter();

adapter.SelectCommand = new OdbcCommand("spUser", conn);

OdbcParameter par = new OdbcParameter("@User",OdbcType.VarChar,20);

par.Value=user;

adapter.SelectCommand.Parameters.Add(par);

adapter.Fill(dsUser);

This is the error:

"ERROR [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Procedure
'spUser' expects parameter '@User', which was not supplied."

What is wrong here

Nov 18 '05 #2

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

Similar topics

0
by: Wedrowiec | last post by:
I have a problem for experienced programmers. The following code should copy data between two different databases: import dbi,odbc conn1=odbc.odbc('mysql'); conn2=odbc.odbc('sqlite') c1 =...
1
by: simianphile | last post by:
OK, I had a problem that I've now fixed but I can't really understand what was causing it in the first place. I have an intranet site that uses basic authentication to allow users to view and...
5
by: SerGioGio | last post by:
Hello, I am going nuts. I am trying to connect to my local ORACLE instance using ODBC. It used to work few weeks ago, but it fails now. Connection with: - SQL*plus: connection works! -...
0
by: Nedelcho Stanev | last post by:
Hello All, I have strange problem with libodbc++ ( 0.2.3 or 0.2.2 ). i'm using mysql-4.0.14 , MyODBC-3.51.06 and unixODBC-2.2.6 configured with following options 1.MySQL ../configure...
0
by: AlessanBar | last post by:
Hello Friends !! I have a strange problem, and I need to know what would be the source of this. I have a laptop computer with the following configuration: Pentium III Brand : Toshiba Speed :...
0
by: TheAd01 | last post by:
In an Access97 application I fetch data from an Oracle database via a linked table (via Odbc/sqlnet). The Oracle database now upgrades from 7.3 to 8.0. The Oracle odbc driver I use (2.0.3.1,...
4
by: Dave | last post by:
Hey guys, I have an ODBC problem that has me stumped. I wrote a VBA script to run in Microsoft Excel that pulls data out of an application using that application's ODBC driver and puts it into...
6
by: Mikey G | last post by:
Hi, Here is a shorter code example since the last message I posted got truncated. So the problem is I created a simple VB.NET 2003 application through Visual Studio that connects to a MySQL...
5
by: Scott M. Lyon | last post by:
I've just discovered a bug in some code I wrote a little while ago, and I need you guys' help to fix it. My program imports data from a standard Excel Spreadsheet (just with specific column...
2
by: Frank Millman | last post by:
Hi all I have found a problem using MS Sql Server connecting via the odbc module from python-win32. I am liaising with Mark Hammond, and he is trying to help, but he is very busy, and I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
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...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.