the_wickedman
New member
- Local time
- Today, 11:34
- Joined
- Aug 12, 2006
- Messages
- 3
In my database, (under Access 2003 (VB6)) I have table "tblPhoto" in which I keep path(s) to my picture(s) like CurrentDatabasePath + "Zdjecia" + .txtPhoto
Count "Photo" looks like:
13.JPG
123.BMP
Ustronie\Zachód.JPG
When I add new pic for ex. 345.JPG to my database (table) I want to chceck if 345.JPG doesn't already exist (in column "Photo") but without showing him -> only get value TRUE/FALSE (it is/it isn't). How search in the table (column Photo)?
I found this (but in VB6 I have problem with SqlConnection/SqlCommand type)
Private Sub znajdz()
Dim cnn As New SqlConnection("Database = Nazwa; Integrated security = SSPI")
Dim cmd As New SqlCommand()
Dim ile As Integer
cmd.Connection = cnn
cmd.CommandText = "select count(*) from Photo where Photo like 'nazwa'"
cnn.Open()
ile = cmd.ExecuteNonQuery()
cnn.Close()
If (ile > -1) Then
MsgBox"Record exists"
Else
MsgBox"Record not found"
End If
End Sub
Count "Photo" looks like:
13.JPG
123.BMP
Ustronie\Zachód.JPG
When I add new pic for ex. 345.JPG to my database (table) I want to chceck if 345.JPG doesn't already exist (in column "Photo") but without showing him -> only get value TRUE/FALSE (it is/it isn't). How search in the table (column Photo)?
I found this (but in VB6 I have problem with SqlConnection/SqlCommand type)
Private Sub znajdz()
Dim cnn As New SqlConnection("Database = Nazwa; Integrated security = SSPI")
Dim cmd As New SqlCommand()
Dim ile As Integer
cmd.Connection = cnn
cmd.CommandText = "select count(*) from Photo where Photo like 'nazwa'"
cnn.Open()
ile = cmd.ExecuteNonQuery()
cnn.Close()
If (ile > -1) Then
MsgBox"Record exists"
Else
MsgBox"Record not found"
End If
End Sub