ODBC - Error

G

Guest

I am getting the followign error when using ODBC from ADO.NET.....
System.Data.Odbc.OdbcException: ERROR [42000] [Microsoft][ODBC SQL Server
Driver][SQL Server]Procedure 'StoredProcedure' expects parameter
'@Parameter', which was not supplied.

I installed latest MDAC , still i am getting error...
any help?
 
P

Paul Clement

¤ I am getting the followign error when using ODBC from ADO.NET.....
¤ System.Data.Odbc.OdbcException: ERROR [42000] [Microsoft][ODBC SQL Server
¤ Driver][SQL Server]Procedure 'StoredProcedure' expects parameter
¤ '@Parameter', which was not supplied.
¤
¤ I installed latest MDAC , still i am getting error...
¤ any help?

You're going to have to post your code and the parameter definitions of your stored procedure in
order for us to troubleshoot this problem.

This error has nothing to do with MDAC.


Paul
~~~~
Microsoft MVP (Visual Basic)
 
G

Guest

Thanks for your reply , i was saying its problem with MDAC because i was
going through couple MSDN knowledge base issues and they suggested to install
the MDAC latest srvice pack...
anyway here is my code.....
Dim db As Database = DatabaseFactory.CreateDatabase("Test")
Dim sqlCommand As String = "dbo.tsp_Test"
Dim dbCommandWrapper As DBCommandWrapper =
db.GetStoredProcCommandWrapper(sqlCommand)
With dbCommandWrapper
.AddInParameter("@username", DbType.String, "Test")
End With
' DataSet that will hold the returned results
Dim productsDataSet As DataSet = Nothing
productsDataSet = db.ExecuteDataSet(dbCommandWrapper)

please suggest....
 
S

Stephany Young

Well there is your problem.

The input parameter to the stored procedure is named @Parameter but you are
adding a parameter called @username.


vsr said:
Thanks for your reply , i was saying its problem with MDAC because i was
going through couple MSDN knowledge base issues and they suggested to
install
the MDAC latest srvice pack...
anyway here is my code.....
Dim db As Database = DatabaseFactory.CreateDatabase("Test")
Dim sqlCommand As String = "dbo.tsp_Test"
Dim dbCommandWrapper As DBCommandWrapper =
db.GetStoredProcCommandWrapper(sqlCommand)
With dbCommandWrapper
.AddInParameter("@username", DbType.String, "Test")
End With
' DataSet that will hold the returned results
Dim productsDataSet As DataSet = Nothing
productsDataSet = db.ExecuteDataSet(dbCommandWrapper)

please suggest....

Paul Clement said:
¤ I am getting the followign error when using ODBC from ADO.NET.....
¤ System.Data.Odbc.OdbcException: ERROR [42000] [Microsoft][ODBC SQL
Server
¤ Driver][SQL Server]Procedure 'StoredProcedure' expects parameter
¤ '@Parameter', which was not supplied.
¤
¤ I installed latest MDAC , still i am getting error...
¤ any help?

You're going to have to post your code and the parameter definitions of
your stored procedure in
order for us to troubleshoot this problem.

This error has nothing to do with MDAC.


Paul
~~~~
Microsoft MVP (Visual Basic)
 
G

Guest

oh ....no.thats just typo error..adding the correct parameter name .......

Stephany Young said:
Well there is your problem.

The input parameter to the stored procedure is named @Parameter but you are
adding a parameter called @username.


vsr said:
Thanks for your reply , i was saying its problem with MDAC because i was
going through couple MSDN knowledge base issues and they suggested to
install
the MDAC latest srvice pack...
anyway here is my code.....
Dim db As Database = DatabaseFactory.CreateDatabase("Test")
Dim sqlCommand As String = "dbo.tsp_Test"
Dim dbCommandWrapper As DBCommandWrapper =
db.GetStoredProcCommandWrapper(sqlCommand)
With dbCommandWrapper
.AddInParameter("@username", DbType.String, "Test")
End With
' DataSet that will hold the returned results
Dim productsDataSet As DataSet = Nothing
productsDataSet = db.ExecuteDataSet(dbCommandWrapper)

please suggest....

Paul Clement said:
¤ I am getting the followign error when using ODBC from ADO.NET.....
¤ System.Data.Odbc.OdbcException: ERROR [42000] [Microsoft][ODBC SQL
Server
¤ Driver][SQL Server]Procedure 'StoredProcedure' expects parameter
¤ '@Parameter', which was not supplied.
¤
¤ I installed latest MDAC , still i am getting error...
¤ any help?

You're going to have to post your code and the parameter definitions of
your stored procedure in
order for us to troubleshoot this problem.

This error has nothing to do with MDAC.


Paul
~~~~
Microsoft MVP (Visual Basic)
 
G

Guest

the same code is working fine with SqlCommand , OleDBCommand its just failing
with ODBCCommand.

Stephany Young said:
Well there is your problem.

The input parameter to the stored procedure is named @Parameter but you are
adding a parameter called @username.


vsr said:
Thanks for your reply , i was saying its problem with MDAC because i was
going through couple MSDN knowledge base issues and they suggested to
install
the MDAC latest srvice pack...
anyway here is my code.....
Dim db As Database = DatabaseFactory.CreateDatabase("Test")
Dim sqlCommand As String = "dbo.tsp_Test"
Dim dbCommandWrapper As DBCommandWrapper =
db.GetStoredProcCommandWrapper(sqlCommand)
With dbCommandWrapper
.AddInParameter("@username", DbType.String, "Test")
End With
' DataSet that will hold the returned results
Dim productsDataSet As DataSet = Nothing
productsDataSet = db.ExecuteDataSet(dbCommandWrapper)

please suggest....

Paul Clement said:
¤ I am getting the followign error when using ODBC from ADO.NET.....
¤ System.Data.Odbc.OdbcException: ERROR [42000] [Microsoft][ODBC SQL
Server
¤ Driver][SQL Server]Procedure 'StoredProcedure' expects parameter
¤ '@Parameter', which was not supplied.
¤
¤ I installed latest MDAC , still i am getting error...
¤ any help?

You're going to have to post your code and the parameter definitions of
your stored procedure in
order for us to troubleshoot this problem.

This error has nothing to do with MDAC.


Paul
~~~~
Microsoft MVP (Visual Basic)
 
S

Stephany Young

Where is the typo?

Are you saying that you typed the error message and the code fragment into
your post and made a typo whilst doing so?

If so, how do you expect anyone to be able to help you with your 'problem'?

Copy and Paste is very good for avoiding typos.


vsr said:
oh ....no.thats just typo error..adding the correct parameter name .......

Stephany Young said:
Well there is your problem.

The input parameter to the stored procedure is named @Parameter but you
are
adding a parameter called @username.


vsr said:
Thanks for your reply , i was saying its problem with MDAC because i
was
going through couple MSDN knowledge base issues and they suggested to
install
the MDAC latest srvice pack...
anyway here is my code.....
Dim db As Database = DatabaseFactory.CreateDatabase("Test")
Dim sqlCommand As String = "dbo.tsp_Test"
Dim dbCommandWrapper As DBCommandWrapper =
db.GetStoredProcCommandWrapper(sqlCommand)
With dbCommandWrapper
.AddInParameter("@username", DbType.String, "Test")
End With
' DataSet that will hold the returned results
Dim productsDataSet As DataSet = Nothing
productsDataSet = db.ExecuteDataSet(dbCommandWrapper)

please suggest....

:

On Thu, 23 Mar 2006 16:29:01 -0800, vsr
<[email protected]>
wrote:

¤ I am getting the followign error when using ODBC from ADO.NET.....
¤ System.Data.Odbc.OdbcException: ERROR [42000] [Microsoft][ODBC SQL
Server
¤ Driver][SQL Server]Procedure 'StoredProcedure' expects parameter
¤ '@Parameter', which was not supplied.
¤
¤ I installed latest MDAC , still i am getting error...
¤ any help?

You're going to have to post your code and the parameter definitions
of
your stored procedure in
order for us to troubleshoot this problem.

This error has nothing to do with MDAC.


Paul
~~~~
Microsoft MVP (Visual Basic)
 
G

Guest

ok..here is the error ....
System.Data.Odbc.OdbcException: ERROR [42000] [Microsoft][ODBC SQL
Server
Driver][SQL Server]Procedure 'dbo.tsp_Test' expects parameter
'@username', which was not supplied.

----------------------------------------------------
Stephany Young said:
Where is the typo?

Are you saying that you typed the error message and the code fragment into
your post and made a typo whilst doing so?

If so, how do you expect anyone to be able to help you with your 'problem'?

Copy and Paste is very good for avoiding typos.


vsr said:
oh ....no.thats just typo error..adding the correct parameter name .......

Stephany Young said:
Well there is your problem.

The input parameter to the stored procedure is named @Parameter but you
are
adding a parameter called @username.


Thanks for your reply , i was saying its problem with MDAC because i
was
going through couple MSDN knowledge base issues and they suggested to
install
the MDAC latest srvice pack...
anyway here is my code.....
Dim db As Database = DatabaseFactory.CreateDatabase("Test")
Dim sqlCommand As String = "dbo.tsp_Test"
Dim dbCommandWrapper As DBCommandWrapper =
db.GetStoredProcCommandWrapper(sqlCommand)
With dbCommandWrapper
.AddInParameter("@username", DbType.String, "Test")
End With
' DataSet that will hold the returned results
Dim productsDataSet As DataSet = Nothing
productsDataSet = db.ExecuteDataSet(dbCommandWrapper)

please suggest....

:

On Thu, 23 Mar 2006 16:29:01 -0800, vsr
<[email protected]>
wrote:

¤ I am getting the followign error when using ODBC from ADO.NET.....
¤ System.Data.Odbc.OdbcException: ERROR [42000] [Microsoft][ODBC SQL
Server
¤ Driver][SQL Server]Procedure 'StoredProcedure' expects parameter
¤ '@Parameter', which was not supplied.
¤
¤ I installed latest MDAC , still i am getting error...
¤ any help?

You're going to have to post your code and the parameter definitions
of
your stored procedure in
order for us to troubleshoot this problem.

This error has nothing to do with MDAC.


Paul
~~~~
Microsoft MVP (Visual Basic)
 
P

Paul Clement

¤ Thanks for your reply , i was saying its problem with MDAC because i was
¤ going through couple MSDN knowledge base issues and they suggested to install
¤ the MDAC latest srvice pack...
¤ anyway here is my code.....
¤ Dim db As Database = DatabaseFactory.CreateDatabase("Test")
¤ Dim sqlCommand As String = "dbo.tsp_Test"
¤ Dim dbCommandWrapper As DBCommandWrapper =
¤ db.GetStoredProcCommandWrapper(sqlCommand)
¤ With dbCommandWrapper
¤ .AddInParameter("@username", DbType.String, "Test")
¤ End With
¤ ' DataSet that will hold the returned results
¤ Dim productsDataSet As DataSet = Nothing
¤ productsDataSet = db.ExecuteDataSet(dbCommandWrapper)
¤

I've never used the Data Application Block, but the sample on the below page doesn't use the "@"
symbol to prefix parameter names.

http://msdn.microsoft.com/library/d...ag2/html/EntLibJan2006_DataAccessAppBlock.asp


Paul
~~~~
Microsoft MVP (Visual Basic)
 
G

Guest

Thanks for the Info , in the parameter we can use "@" or without that also we
can pass parameter names, internally MS Application Block checking for the
"@" character.

After lot of struggle i got the solution , for ODBC Commands we need to pass
the special Command text and not just the name of the procedure....
for ex: SP Name : tsp_Sample and if this accepsts two parameters then
command text should be like this....

Without Return Val : CommandText = "{call tsp_Sample(?,?)}"
With Return Val : CommandText = "{call ?= tsp_Sample(?,?)}"

and works fine...
Thanks again all for the support.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top