473,473 Members | 2,274 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

oledbParameter has no default value

Hi,

I've got an oledb parameter that I'm sending to an Access DB.
The table I'm sending it to has a column called "Zone" of type String that
has a default value of "".

So I create the parameter with its name and dbType, and add it to an
Insertcommand.
I then set the Command.Text value.

Sample code goes like this;
....
OleDBParameter prmZone = new OleDBParameter("Zone", OleDbType.VarChar);
prmZone.SourceColumn = myDataSet.tblRecords.ZoneColumn;//Using a typed
dataset
cmdInsert.Parameters.Add(prmZone);
cmdInsert.CommandText = "INSERT INTO tblRecords VALUES(ID, Zone...)";

RecordsAdapter.InsertCommand = cmdInsert;

RecordsAdapter.Update(myDataSet, "tblRecords");

When I run this code, I get a run-time error "Parameter Zone has no default
value".

If my table has a default value, and the parameter gets assigned a value
from the dataset (I checked and there are no blank fields), why would I get
this error?

Any thoughts would be appreciated.

Regards,

Marco
Nov 15 '05 #1
1 4565
never mind (sigh), didn't place the params in the right order...

Marco
"Marco Martin" <ma**********@sympatico.ca.antispam> wrote in message
news:r8********************@news20.bellglobal.com. ..
Hi,

I've got an oledb parameter that I'm sending to an Access DB.
The table I'm sending it to has a column called "Zone" of type String that
has a default value of "".

So I create the parameter with its name and dbType, and add it to an
Insertcommand.
I then set the Command.Text value.

Sample code goes like this;
...
OleDBParameter prmZone = new OleDBParameter("Zone", OleDbType.VarChar);
prmZone.SourceColumn = myDataSet.tblRecords.ZoneColumn;//Using a typed
dataset
cmdInsert.Parameters.Add(prmZone);
cmdInsert.CommandText = "INSERT INTO tblRecords VALUES(ID, Zone...)";

RecordsAdapter.InsertCommand = cmdInsert;

RecordsAdapter.Update(myDataSet, "tblRecords");

When I run this code, I get a run-time error "Parameter Zone has no default value".

If my table has a default value, and the parameter gets assigned a value
from the dataset (I checked and there are no blank fields), why would I get this error?

Any thoughts would be appreciated.

Regards,

Marco

Nov 15 '05 #2

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

Similar topics

6
by: TattyMane bigpond.net.au> | last post by:
Hi I am trying to follow the walkthrough on MSDN http://msdn.microsoft.com/library/en-us/vbcon/html/vbwlkWalkthroughUpdatingDataUsingDatabaseUpdateQueryInWebForms.asp however, as I do not have...
3
by: bby | last post by:
what's wrong? string SQL="update D_User set Photo=@Photo where ID=@ID"; OleDbCommand myCommand=new OleDbCommand (SQL,connection); OleDbParameter myParm1 =new...
1
by: Steven K | last post by:
Hello, I am calling a SQL Server 2K parameter query with the following: Dim spWebDocGroup As OleDb.OleDbDataReader Dim prmWebDocGroup As OleDbParameter Dim cmdWebDocGroup As New...
2
by: Sagaert Johan | last post by:
Hi I try to use this as sql string ( The field i compare with is variable. ) "SELECT * FROM FMatrix WHERE @wantedfield=@criteria" i use the Parameters.Add with OleDbType.WChar . Why can't...
3
by: Agnes | last post by:
Dim ocmdElem As New OleDbCommand() With ocmdElem .Parameters.Add(New OleDbParameter("@cocode", OleDbType.VarChar, 10, "TEST")) .CommandText = "select loginid from coinfo where code =@cocode "...
1
by: Agnes | last post by:
..Parameters.Add(New OleDbParameter("@cocode", OleDbType.VarChar, 10, UserName)) (A).CommandText = "select 'loginid' from 'coinfo' where 'loginid' = ? " (B).CommandText = "select loginid from...
2
by: DC | last post by:
The Code <%@ import namespace="System" %> <%@ import namespace="System.Web" %> <%@ import namespace="System.Web.UI" %> <%@ import namespace="System.Web.UI.HtmlControls" %> <%@ import...
1
by: DC | last post by:
The problem I'm using the .NET GridView and FormView objects for the first time and im getting the error "An OleDbParameter with ParameterName '@ID' is not contained by this...
0
by: DC | last post by:
I'm getting an error "System.Data.OleDb.OleDbException: No value given for one or more required parameters". I was wondering how do I trace which parameter is not being passed a value in a OleDb...
0
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...
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...
1
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
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
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...

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.