|
-
Apr 29th, 2006, 07:11 AM
#1
Thread Starter
Fanatic Member
database problem (ole)
Option Explicit
Public connString As String
Public connMain As New ADODB.Connection
Public rs As ADODB.Recordset
Public htmTitle As String
Dim pBag As PropertyBag
Dim pByteA() As Byte
Private Sub Command1_Click()
loadRecord Text1.Text
End Sub
Private Sub Command2_Click()
CommonDialog1.ShowOpen
Media1.FileName = CommonDialog1.FileName
Media1.Play
End Sub
Private Sub Command3_Click()
Dim strQuery
'Create propertybag
Set pBag = New PropertyBag
'Write object
pBag.WriteProperty "Myvideo", Media1
'Fill array with binary data of pic
pByteA = pBag.Contents
'Write data to database
'strQuery = "INSERT INTO Employees (emppic) VALUES (" & pByteA & ")"
'connMain.Execute strQuery
rs.AddNew
rs.Fields("datas").Value = pByteA
rs.Update
End Sub
Private Sub Form_Load()
connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & "c:\my documents\ghfr.mdb;Persist Security Info=False;"
connMain.Open connString
Set rs = New ADODB.Recordset
rs.Open "viveks", connMain, adOpenKeyset, adLockPessimistic, adCmdTable
End Sub
Private Sub loadRecord(strkey As String)
Dim strQuery As String
Dim objRs As Recordset
Set objRs = New ADODB.Recordset
strQuery = "Select * from viveks where empid = " & strkey
objRs.Open strQuery, connMain
On Error Resume Next
pByteA = objRs.Fields("datas").Value
Set pBag = New PropertyBag
pBag.Contents = pByteA
Set Media1 = pBag.ReadProperty("Myvideo")
objRs.Close
End Sub
The code is not working. I am trying to save a .avi to database but it is showing error.
-
Apr 29th, 2006, 07:20 AM
#2
Re: database problem (ole)
what line does the error occur on?
-
Apr 30th, 2006, 02:12 AM
#3
Re: database problem (ole)
Also use the VBCODE tags for your code to make it more readable.
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
|