|
-
Feb 2nd, 2003, 12:23 PM
#1
Thread Starter
Sleep mode
Search db [unresolved]
How can I search my access db ? Can anyone send me a link ..?
thanx
Last edited by Pirate; Feb 2nd, 2003 at 11:54 PM.
-
Feb 2nd, 2003, 02:01 PM
#2
Thread Starter
Sleep mode
-
Feb 2nd, 2003, 02:05 PM
#3
Thread Starter
Sleep mode
I know how to Update and Add but all what I want is to search and delete !
thanx for any help !
-
Feb 2nd, 2003, 02:11 PM
#4
DELETE FROM [Table Name] WHERE [some column] = 'some value'
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
Feb 2nd, 2003, 02:13 PM
#5
Thread Starter
Sleep mode
Originally posted by Lord_Rat
DELETE FROM [Table Name] WHERE [some column] = 'some value'
thanx Lord but how can I use this ?
-
Feb 2nd, 2003, 04:10 PM
#6
Thread Starter
Sleep mode
-
Feb 2nd, 2003, 05:16 PM
#7
Thread Starter
Sleep mode
so far , I've this code to delete a record .I got everything correct and msgbox shown that the record has been deleted but when I check the source it's still there (it's not updating).so what am I doing wrong here ?
VB Code:
Dim DelStr = "DELETE FROM [mytab] WHERE [URL]" = "'www.hotmail.com'"
Dim MyCommandDEL As New OleDbCommand(DelStr, MyConnection)
MyAdapter.Fill(MyDataset, "MyTab")
MyAdapter.Update(MyDataset, "MyTab")
MessageBox.Show("Data Deleted...")
-
Feb 2nd, 2003, 11:55 PM
#8
Thread Starter
Sleep mode
anyone !
-
Feb 3rd, 2003, 09:49 AM
#9
Addicted Member
I am nowhere near VS.NET to check, but it might just be that the operation has not been commited - just a wild guess!!
-
Feb 3rd, 2003, 11:36 AM
#10
Dim DelStr = "DELETE FROM [mytab] WHERE [URL] = 'www.hotmail.com'"
Dim MyCommandDEL As New OleDbCommand(DelStr, MyConnection)
MyCommandDEL.ExecuteNonQuery()
msgbox("Done")
See my changes in bold.
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
Feb 3rd, 2003, 12:35 PM
#11
Thread Starter
Sleep mode
Originally posted by Lord_Rat
Dim DelStr = "DELETE FROM [mytab] WHERE [URL] = 'www.hotmail.com'"
Dim MyCommandDEL As New OleDbCommand(DelStr, MyConnection)
MyCommandDEL.ExecuteNonQuery()
msgbox("Done")
See my changes in bold.
First , Sorry for being a pain and thanx for the reply.I tried the code you offered but gives following errors :
an unhandled exception of type 'system.data.oledb.oledbexception' occurred in system.data.dll
no value given for one or more required parameters.
in line "MyCommandDEL.ExecuteNonQuery()"
VB Code:
Dim myps As String = "passme"
Public MyP As String = Application.StartupPath & "\webdb.mdb"
Public MyConnection1 As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & MyP & ";Jet OLEDB:Database Password=" & myps)
Private Sub Button2_Click(ByVal sender As System.Object _
, ByVal e As System.EventArgs) Handles Button2.Click
MyConnection1.Open()
Dim DelStr = "DELETE FROM [mytab] WHERE [URL] = 'www.hotmail.com'"
Dim MyCommandDEL As New OleDbCommand(DelStr, MyConnection1)
Try
MyCommandDEL.ExecuteNonQuery()
Catch x As Exception
MsgBox(x.Message)
End Try
MsgBox("Done")
End Sub
Thanx for your time !
-
Feb 3rd, 2003, 12:55 PM
#12
Well, here is my function:
VB Code:
Private Function ExecuteNonReader(ByVal SQLText As String) As Boolean
If Not conn.State = ConnectionState.Open Then
conn.Open() 'Global connection object
End If
Dim objCmd As New SqlClient.SqlCommand(SQLText, conn)
Try
objCmd.ExecuteNonQuery()
Catch ee As Exception
msgbox(ee.InnerException)
Return False
End Try
Return True
End Function
When I want to run a command such as yours, I put in code:
VB Code:
ExecuteNonReader("DELETE FROM MYTABLE WHERE MYCOL='value'")
Eventhough I am using the SQL object, the same code works for the OLEDB object.
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
Feb 3rd, 2003, 03:59 PM
#13
Thread Starter
Sleep mode
Deletion problem sorted
What a cute Function !
a million thanx Lord_Rat .
I'd to change sqlclient to oledb .easy job .
What left now is search issue .any idea ?
thanx again
-
Feb 3rd, 2003, 04:14 PM
#14
You'll need to describe search. I think an example search would help immensely.
Need to re-register ASP.NET?
C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i
(Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)
-
Feb 4th, 2003, 11:30 AM
#15
Thread Starter
Sleep mode
Originally posted by Lord_Rat
You'll need to describe search. I think an example search would help immensely.
I'don't have any search example .only (vb6 code if you want have a look at it !!).thanx Lord_Rat
-
Feb 5th, 2003, 06:36 AM
#16
Thread Starter
Sleep mode
I don't want to go back to adodb , which is the only option I can find .
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|