Error While Deleteing Row From Database Using ExecuteNonQuery

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Kevin (Kevin_at_discussions.microsoft.com)
Date: 01/20/05


Date: Wed, 19 Jan 2005 19:05:03 -0800

I want to delete a row in database using SQL delete statement, with
parameters and Executenonquery capturing the return to confirm the number of
rows deleted. I code this in a standard way such as "Delete From Clients
Where ClientID = @ClientID And FName = @OldFname...." The paramters are
assigned in With statements like:
.Add("@ClientID", sqldbtype.int)

.Parameters("@ClientID").value = client.clientID

The error I keep getting is that the variable name @ClientID must be unique...

I don't know if it matters but ClientID is the primary key for this table.

I have tried some variations including just listing the ClientID field in
the SQL Statment. While this in fact deleted the row in the database,
Executenonquery returned a 0 showing no rows changed.

Any suggestions or tips would be appreciated.



Relevant Pages

  • Delete Data Row
    ... I don't know if it matters but ClientID is the primary key for this table. ... the SQL Statment. ... While this in fact deleted the row in the database, ...
    (microsoft.public.data.ado)
  • Re: Controlsource wont let Dlookup to enter
    ... You might have to rebuild the form or you might need to decompile your database. ... as such, complaining about syntax error. ... If those were the points You've listed, it would at least let me finish the entrance in the ControlSource and then show an error in the ... Do you have the ClientID field bound to a control on the form? ...
    (microsoft.public.access.gettingstarted)
  • Re: Controlsource wont let Dlookup to enter
    ... You might have to rebuild the form or you might need to decompile your database. ... as such, complaining about syntax error. ... If those were the points You've listed, it would at least let me finish the entrance in the ControlSource and then show an error in the ... Do you have the ClientID field bound to a control on the form? ...
    (microsoft.public.access.gettingstarted)
  • SQL error
    ... I am attempting to permit the user to select 1 of 3 options in the display of database records. ... OptSchedule(0) is titled: ... The SQL statement worked before I included the sSchedule variable also. ... strSQL = "SELECT LastName, FirstName, ClientID, " ...
    (comp.lang.basic.visual.misc)
  • Re: query error
    ... If you're not familiar with SQL, open the query in Design view, then select ... relationship is between ClientID in Client and customer in company. ... "John W. Vinson" wrote: ...
    (microsoft.public.access.queries)