Click here to Skip to main content
16,015,594 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionA connection was successfully established with the server, but Pin
pandapatin23-Feb-06 15:31
pandapatin23-Feb-06 15:31 
AnswerRe: A connection was successfully established with the server, but Pin
Dave Kreskowiak24-Feb-06 16:50
mveDave Kreskowiak24-Feb-06 16:50 
GeneralRe: A connection was successfully established with the server, but Pin
pandapatin25-Feb-06 0:44
pandapatin25-Feb-06 0:44 
GeneralRe: A connection was successfully established with the server, but Pin
Dave Kreskowiak25-Feb-06 3:40
mveDave Kreskowiak25-Feb-06 3:40 
Questionhow to save image file into sql database Pin
thepityone23-Feb-06 14:07
thepityone23-Feb-06 14:07 
AnswerRe: how to save image file into sql database Pin
Rana Muhammad Javed Khan23-Feb-06 17:53
Rana Muhammad Javed Khan23-Feb-06 17:53 
GeneralRe: can save image file into text or dat..? Pin
campbells23-Feb-06 18:13
campbells23-Feb-06 18:13 
AnswerRe: how to save image file into sql database Pin
alien viper23-Feb-06 18:15
alien viper23-Feb-06 18:15 
Private Sub SaveImageToSql()
'Try this example.
'This is not the best way but if you have no other way, try it.
'*********************************************
'You must StoredProcedure like this
'@Image image
'"INSERT INTO Table ([Image]) VALUES (@Image)"
'*********************************************
Dim connStr As String = "Connection String" ' Set Your Connection String

Dim filePath As String = "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpg" ' Set Your Image File Path
Dim fs As IO.FileStream = New IO.FileStream(filePath, IO.FileMode.Open, IO.FileAccess.Read)
Dim br As New IO.BinaryReader(fs)
Dim bytes() As Byte = br.ReadBytes(fs.Length)
Dim sqlImg As New SqlTypes.SqlBinary(bytes)

Dim conn As New SqlClient.SqlConnection(connStr)
Dim cmd As New SqlClient.SqlCommand("StoredProcedureName", conn)
Try
Dim sqlP As New SqlClient.SqlParameter("@Image", SqlDbType.Image)
sqlP.Value = sqlImg
cmd.Parameters.Add(sqlP)
conn.Open()
cmd.ExecuteNonQuery()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
conn.Close()
conn.Dispose()
cmd.Dispose()
br.Close()
fs.Close()
br = Nothing
fs = Nothing
bytes = Nothing
End Try

End Sub

!alien!
QuestionAutonumeric byte column wont increment Pin
AlexeiXX323-Feb-06 13:59
AlexeiXX323-Feb-06 13:59 
AnswerRe: Autonumeric byte column wont increment Pin
Dave Kreskowiak24-Feb-06 1:13
mveDave Kreskowiak24-Feb-06 1:13 
QuestionRe: Autonumeric byte column wont increment Pin
AlexeiXX324-Feb-06 4:26
AlexeiXX324-Feb-06 4:26 
AnswerRe: Autonumeric byte column wont increment Pin
Dave Kreskowiak24-Feb-06 9:06
mveDave Kreskowiak24-Feb-06 9:06 
QuestionMight be a stupid question but... Pin
Darshon23-Feb-06 11:08
Darshon23-Feb-06 11:08 
AnswerRe: Might be a stupid question but... Pin
Dean_SF24-Feb-06 9:20
Dean_SF24-Feb-06 9:20 
GeneralRe: Might be a stupid question but... Pin
Darshon24-Feb-06 10:43
Darshon24-Feb-06 10:43 
GeneralRe: Might be a stupid question but... Pin
Dean_SF24-Feb-06 10:56
Dean_SF24-Feb-06 10:56 
GeneralRe: Might be a stupid question but... Pin
Darshon24-Feb-06 11:15
Darshon24-Feb-06 11:15 
GeneralRe: Might be a stupid question but... Pin
Dean_SF24-Feb-06 11:24
Dean_SF24-Feb-06 11:24 
GeneralRe: Might be a stupid question but... Pin
Darshon24-Feb-06 11:34
Darshon24-Feb-06 11:34 
GeneralRe: Might be a stupid question but... Pin
Darshon24-Feb-06 13:37
Darshon24-Feb-06 13:37 
GeneralRe: Might be a stupid question but... Pin
Darshon24-Feb-06 15:57
Darshon24-Feb-06 15:57 
QuestionForm created by thread inaccessible Pin
RJGCarey23-Feb-06 10:52
RJGCarey23-Feb-06 10:52 
AnswerRe: Form created by thread inaccessible Pin
Joshua Quick24-Feb-06 8:10
Joshua Quick24-Feb-06 8:10 
QuestionStupid question Pin
teuneboon23-Feb-06 9:55
teuneboon23-Feb-06 9:55 
AnswerRe: Stupid question Pin
J4amieC23-Feb-06 10:17
J4amieC23-Feb-06 10:17 

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.