borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (fomular in table SQL)Next Topic (parameter in dataenviroment designer.) New Topic New Poll Post Reply
AndreaVB Forum : Database : Delete specfic record Query???
Poster Message
Gary
Level: Sage

Registered: 27-11-2005
Posts: 50

icon Delete specfic record Query???

Hi there,

Let say I wish to delete a row of record which contains StudentID, ModuleID and SessionID

My delete query is as below,

rs.Open "DELETE FROM V_ModuleReg WHERE ModuleID ='" & frmModuleReg.txtModuleID.Text & "'"

It works fine but it will delete all the students records which are having the same ModuleID since I only delete it according to ModuleID...

May I know how should I write the sql query if I wish to delete it according to ModuleID and StudentID

Thank you


Gary  

20-10-2006 at 03:12 AM
View Profile Send Email to User Show All Posts | Quote Reply
GeoffS
Level: VB Lord


Registered: 29-09-2004
Posts: 536
icon Re: Delete specfic record Query???

"DELETE FROM V_ModuleReg WHERE (((ModuleID) ='" & frmModuleReg.txtModuleID.Text & "') AND ((StudentID) = '" & frmModuleReg.txtStudentID.Text & "'))"

That is assuming that the StudentID data type is text  like your query indicates for the ModuleID. If it is numeric then leave out the quotes (') around the ID and coerce the textbox to a Long :-
Dim lngID As Long
lngID = CLng(frmModuleReg.txtStudentID.Text)

"DELETE FROM V_ModuleReg WHERE (((ModuleID) ='" & frmModuleReg.txtModuleID.Text & "') AND ((StudentID) = " & lngID & "))"



____________________________
multi-tasking - the ability to hang more than one app. at the same time.

20-10-2006 at 05:23 AM
View Profile Send Email to User Show All Posts | Quote Reply
Gary
Level: Sage

Registered: 27-11-2005
Posts: 50
icon Re: Delete specfic record Query???

Thanks friend,

This problem solved... another serious problem arise! My ADO or recordset unable to connect to the SQL Server 2000...
It displays an error message and states that "SQL Server does not exist or access denied"

I have reinstalled my SQL Server 2000 for few times but still the same... Any idea on this

Thank you...


Gary

26-10-2006 at 07:05 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : Database : Delete specfic record Query???
Previous Topic (fomular in table SQL)Next Topic (parameter in dataenviroment designer.) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder