Click here to Skip to main content
15,881,172 members
Home / Discussions / Database
   

Database

 
AnswerRe: Validate DateTime in storeproc Pin
-Dr_X-13-Oct-05 8:46
-Dr_X-13-Oct-05 8:46 
GeneralRe: Validate DateTime in storeproc Pin
miah alom13-Oct-05 8:48
miah alom13-Oct-05 8:48 
QuestionUpdate/Insert Dilema Pin
Vodstok11-Oct-05 3:01
Vodstok11-Oct-05 3:01 
AnswerRe: Update/Insert Dilema Pin
Michael Potter11-Oct-05 3:54
Michael Potter11-Oct-05 3:54 
GeneralRe: Update/Insert Dilema Pin
Vodstok11-Oct-05 9:15
Vodstok11-Oct-05 9:15 
QuestionOracle database Question.. Pin
Member 123981310-Oct-05 10:39
Member 123981310-Oct-05 10:39 
AnswerRe: Oracle database Question.. Pin
enjoycrack11-Oct-05 16:09
enjoycrack11-Oct-05 16:09 
QuestionSaving and retrieving pictures Pin
Erik Lund10-Oct-05 4:45
Erik Lund10-Oct-05 4:45 
I am working with an access application as front end to a sql server database. One of the tables is a picture table with 2 fields, an Id field and an Image field.

J has problems with saving and retrieving bmp files using the stream object.

I would be happy if anyone has a solution.

The 2 sets of codes are:

Private Sub PickupPicture()
Dim db As ADODB.Connection
Set db = CurrentProject.Connection
Dim st As ADODB.Stream
Dim rs As New ADODB.Recordset
Dim SqlString As String
Dim MyPath As String
MyPath = CurrentProject.Path & "\Pictures\Temp.bmp"
SqlString = "SELECT Picture " _
& "FROM tbPicture " _
& "WHERE ((Id)=" & MyId & ");"
rs.Open SqlString, db, adOpenStatic, adLockReadOnly
If Dir(MyPath) <> "" Then
Kill MyPath
End If
Set st = New ADODB.Stream
st.Type = adTypeBinary
st.Open
st.Write rs.Fields("Picture").Value
st.SaveToFile (MyPath) 'full path for bmp file
st.Close
rs.Close
db.Close
UserForm1.Image1.Picture = LoadPicture("")
UserForm1.Image1.Picture = LoadPicture(MyPath)
End Sub

Private Sub SavePicture()
Dim db As ADODB.Connection
Set db = CurrentProject.Connection
Dim st As ADODB.Stream
Dim rs As New ADODB.Recordset
Dim SqlString As String
SqlString = "SELECT * FROM tbPicture;"
rs.Open SqlString, db, adOpenKeyset, adLockOptimistic
rs.AddNew
rs!ID = MinId
rs.Update
rs.Close
SqlString = "SELECT Picture " _
& "FROM tbPicture " _
& "WHERE ((Id)=" & MinId & ");"
rs.Open SqlString, db, adOpenKeyset, adLockOptimistic
Set st = New ADODB.Stream
st.Type = adTypeBinary
st.Open
st.LoadFromFile (Image1.Tag) 'full path for bmp file
rs.Fields("Picture").Value = st.Read
rs.Update
st.Close
rs.Close
db.Close
End Sub

Best regard
Erik Lund
QuestionDeploying MSDE Pin
steve_m_m10-Oct-05 0:27
steve_m_m10-Oct-05 0:27 
QuestionUn-natural sort order... Pin
ModuleKev10-Oct-05 0:20
ModuleKev10-Oct-05 0:20 
AnswerRe: Un-natural sort order... Pin
Colin Angus Mackay10-Oct-05 1:09
Colin Angus Mackay10-Oct-05 1:09 
GeneralRe: Un-natural sort order... Pin
Nic Rowan10-Oct-05 1:14
Nic Rowan10-Oct-05 1:14 
GeneralRe: Un-natural sort order... Pin
ModuleKev10-Oct-05 1:15
ModuleKev10-Oct-05 1:15 
AnswerRe: Un-natural sort order... Pin
Nic Rowan10-Oct-05 1:11
Nic Rowan10-Oct-05 1:11 
GeneralRe: Un-natural sort order... Pin
ModuleKev10-Oct-05 1:24
ModuleKev10-Oct-05 1:24 
GeneralRe: Un-natural sort order... Pin
Nic Rowan10-Oct-05 1:48
Nic Rowan10-Oct-05 1:48 
GeneralRe: Un-natural sort order... Pin
ModuleKev10-Oct-05 1:52
ModuleKev10-Oct-05 1:52 
AnswerRe: Un-natural sort order... Pin
miah alom10-Oct-05 5:01
miah alom10-Oct-05 5:01 
GeneralRe: Un-natural sort order... Pin
ModuleKev10-Oct-05 5:56
ModuleKev10-Oct-05 5:56 
GeneralRe: Un-natural sort order... Pin
miah alom10-Oct-05 6:31
miah alom10-Oct-05 6:31 
QuestionHow to find table in Access databse??? Pin
Rohan_bhat_319-Oct-05 21:42
Rohan_bhat_319-Oct-05 21:42 
AnswerRe: How to find table in Access databse??? Pin
S Douglas20-Oct-05 23:38
professionalS Douglas20-Oct-05 23:38 
GeneralRe: How to find table in Access databse??? Pin
Rohan_bhat_3121-Oct-05 0:03
Rohan_bhat_3121-Oct-05 0:03 
GeneralRe: How to find table in Access databse??? Pin
S Douglas21-Oct-05 0:19
professionalS Douglas21-Oct-05 0:19 
QuestionList of databases on mySQL server Pin
Golden Dragon9-Oct-05 14:08
Golden Dragon9-Oct-05 14:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.