473,324 Members | 2,214 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,324 software developers and data experts.

executereader error

I get this error when trying to run a SQL command, maybe my program is
silly, I'm pretty new at this :

Additional information: SqlCommand.Prepare method requires all variable
length parameters to have an explicitly set non-zero Size.

selcmd.Connection = con

selcmd.CommandText = "SELECT identcol FROM resumeconv_directories"

selcmd.Parameters.Add("@directoryname", SqlDbType.Char)

selcmd.Parameters("@directoryname").Direction = ParameterDirection.Input

selcmd.Parameters("@directoryname").Value = thedirectory

selcmd.Parameters.Add("@identcol", SqlDbType.Int)

selcmd.Parameters("@identcol").Direction = ParameterDirection.Output

selcmd.Prepare()

selcmd.ExecuteReader()

MsgBox(selcmd.Parameters("@identcol").Value)
Jul 21 '05 #1
1 4890
Looks like you need to specify length of your Char param.

"MSNEWS" <xx@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
I get this error when trying to run a SQL command, maybe my program is
silly, I'm pretty new at this :

Additional information: SqlCommand.Prepare method requires all variable
length parameters to have an explicitly set non-zero Size.

selcmd.Connection = con

selcmd.CommandText = "SELECT identcol FROM resumeconv_directories"

selcmd.Parameters.Add("@directoryname", SqlDbType.Char)

selcmd.Parameters("@directoryname").Direction = ParameterDirection.Input

selcmd.Parameters("@directoryname").Value = thedirectory

selcmd.Parameters.Add("@identcol", SqlDbType.Int)

selcmd.Parameters("@identcol").Direction = ParameterDirection.Output

selcmd.Prepare()

selcmd.ExecuteReader()

MsgBox(selcmd.Parameters("@identcol").Value)


Jul 21 '05 #2

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

Similar topics

6
by: BuddyWork | last post by:
Does anyone know if there are any articles explaining how I could debug into SqlCommand.ExecuteReader so I can see why I am getting a particular error. thanks
0
by: BuddyWork | last post by:
Hello, The problem is that when using SqlCommand.ExecuteReader and the SQL statement raises an error of severity of 16 then ExecuteReader throws an exception, when you use...
6
by: karim | last post by:
I have an asp.net page that stopped running properly giving the error below. The app uses a SQL Server 2000 on another server. Enterprise Manager and Query analyzer on the web server can connect to...
2
by: MattB | last post by:
I'm trying to implement an example I found for displaying images stored in a SQL database. The example code looks like this (in page_load): Dim connstr As String = "Integrated...
1
by: shahi | last post by:
Hi all, i have a sp that produce an error when execute by some special parameters. i write a program in vb.net that execute it, but i come accross a strange problem: when i execute the sp...
7
by: Alec MacLean | last post by:
Hi all, I'm trying to deploy an ASP.NET (1.1) app to our production webserver, but having problems with the DAAB (from Ent Lib June 2005). As you might guess, it works just fine and dandy on my...
4
by: phil | last post by:
Hi, With the code below, i get the error: ExecuteReader: Connection property has not been initialized. Description: An unhandled exception occurred during the execution of the current web...
1
by: fniles | last post by:
I am using OLEDBDataReader to read from an Access database. I have 4 data source where I get my data from, and each data source is in its own thread. When receiving data, if it is a new...
2
by: Martin Z | last post by:
I'm using the TableAdapterHelper to set the connection and transaction properties on all the commands of all my typed table adapters.... I've checked at the time of the error and all the commands...
7
by: fniles | last post by:
I am using VB.Net 2003 and MS Access (connecting using OleDBConnection). I read using DataAdapter and DataSet, not DataReader. When many people try to access the database at the same time, I get...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.