I am using VB 2005 with a Access data base and I am getting the following error code.
“Parameter [@DonorID] has no default value.
objCommand = New OleDbCommand("Deductable_Delete", objConnection)
objCommand.CommandType = CommandType.StoredProcedure
objCommand.Parameters.Add("@DonorID", OleDbType.Guid, 16, New Guid(txtDonorID.Text).ToString) ‘
'open the dataBase connection
OpenConnection()
intRowsAffected = objCommand.ExecuteNonQuery()
close etc...
Is my problem in access or vb. The "ToString" was added to get rid of a sintax error.
Thanks for the help.

Problems deleting a record.
delamble
Thanks, The first reply fixed it. Thank you so much
AACharlie
mdrelyea
This code worked for me:
OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\db1.mdb;");conn.Open();
OleDbCommand cmd = conn.CreateCommand();cmd.CommandText =
"Delete_Deductable";cmd.CommandType =
CommandType.StoredProcedure; OleDbParameter p1 = cmd.Parameters.Add("p1", OleDbType.Guid);p1.Value =
new Guid("{7C2DE17F-1746-47C8-B07C-203396B8D1CF}");cmd.ExecuteNonQuery();
My table is ->
Deductable
myguid (autonumber guid)
junkvalue text
Sproc:
DELETE Deductable.myguid
FROM Deductable
WHERE (((Deductable.myguid)=[DonorID]));
leclerc9
you did not give the correct value to the parameter. It should be:
objCommand.Parameter.Add("@DonorID", OleDbType.Guid, 16).Value = new Guid(txtDonerID.Text)
Alternatively try this:
Dim theParamater as new OleDbParameter("@DonorID", OleDbType.Guid, 16)
theParameter.Value = new Guid(txtDonerID.Text)
objCommand.Parameters.Add(theParameter)
does this work for you the last parameter you supplied in the objCommand.Parameters.Add() is invalid as the last one should be a source column....not the value of the column you need to pass