 |
| ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

January 12th, 2007, 07:57 AM
|
|
Authorized User
|
|
Join Date: Mar 2006
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Problems In Deleting Record
Hi,
I'm trying to Delete a record in a table but its not getting deleted.. i'm listing the code below. I suppose there's some mistake .. but not sure where..
Code:
MyReportTableAdapter myReports = new MyReportTableAdapter();
myReports.DeleteReport(ID, "Report"); //ID is string
------
This is the code to access the DB in the xsd file
<DeleteCommand>
<DbCommand CommandType="Text" ModifiedByUser="True">
<CommandText>DELETE FROM TblMyRpts WHERE (MUserID = :UserID)
AND (MRptId = (SELECT RptID FROM TblRpts WHERE (RptName = :ReportName)))
</CommandText>
<Parameters>
<Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="UserID" Precision="0" ProviderType="Integer" Scale="0" Size="0" SourceColumnNullMapping="False" SourceVersion="Current">
</Parameter>
<Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="AnsiString" Direction="Input" ParameterName="ReportName" Precision="0" Scale="0" Size="0" SourceColumnNullMapping="False" SourceVersion="Current">
</Parameter>
</Parameters>
</DbCommand>
</DeleteCommand>
------------------------------------------------------------------------------------------------------------
Adventure, Play, Alive, Fast, Race, Addict, React, Attack, Heat, Aggression, Blast, Ahead, Escape, Challenge, Anarchy, Game, Real, Damage, Insane, Acclerate,Passion, Fear, Dominate, Crazy, Awesome, Sweat, Habit, Avenge, Balls, Imagine, Viril, Chaos, Amuse, Heavy, Panic, @#!%, Fanatic
__________________
------------------------------------------------------------------------------------------------------------
<b><i>Adventure, Play, Alive, Fast, Race, Addict, React, Attack, Heat, Aggression, Blast, Ahead, Escape, Challenge, Anarchy, Game, Real, Damage, Insane, Acclerate,Passion, Fear, Dominate, Crazy, Awesome, Sweat, Habit, Avenge, Balls, Imagine, Viril, Chaos, Amuse, Heavy, Panic, @#!%, Fanatic </i></b>
|
|

January 12th, 2007, 09:40 AM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
If a record isn't deleteing it is probably because of your WHERE statement being incorrect. Are you sure that the above code is actually connecting to the database? Have you printed out the SQL statement to verifiy the row you are trying to delete actually exists in the database?
-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
^^Thats my signature
|
|

January 12th, 2007, 11:52 PM
|
|
Authorized User
|
|
Join Date: Mar 2006
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
The query is correct as it works when i directly run it on the database. I'm sure this is the code that's connecting to the db, i just copy pasted it from the .xsd file. And yes the row is present in the DB, strangely enough if instead of the inner query i give the RptId directly it works, so i assume its something else that i might b overlooking. If there's another way to do it please let me know.
------------------------------------------------------------------------------------------------------------
Adventure, Play, Alive, Fast, Race, Addict, React, Attack, Heat, Aggression, Blast, Ahead, Escape, Challenge, Anarchy, Game, Real, Damage, Insane, Acclerate,Passion, Fear, Dominate, Crazy, Awesome, Sweat, Habit, Avenge, Balls, Imagine, Viril, Chaos, Amuse, Heavy, Panic, @#!%, Fanatic
|
|
 |