Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 help!!!sound in vb.net , SQL Server 2000

Author  Topic 

sophiekat
Starting Member

1 Post

Posted - 2005-08-13 : 16:11:59
Hi everyone.I realy need your help.
I have a windows application in VB.net & SQL SERVER 2000.
I create a table in sql server 2000 in which will be saved soundfiles.Its name is SampleSoundTable and it has a field named samplesound (type binary).
I have created a store procedure named insert_SAmpleSoundTable_1 :

CREATE PROCEDURE [insert_SampleSoundTable_1]
(@samplesound_1 [binary](50))

AS INSERT INTO [Sound].[dbo].[SampleSoundTable]
( [samplesound])

VALUES
( @samplesound_1)
GO

The form has one textbox and 3 buttons

The 1st button has that code behind:


Private Sub btnseltfile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnseltfile.Click
OpenFileDialog1.ShowDialog()
txtSound.Text = OpenFileDialog1.FileName
End Sub

(When i choose a sound file from my documents or anywhere else in the text box i can see its path)

The 2nd button has that code behind:

Private Sub btnUpload_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpload.Click
Try
If Trim(txtSound.Text) = "" Then
MsgBox("Please select a image.")
Exit Sub
End If
Dim fs As New FileStream(Trim(txtSound.Text), FileMode.Open)
Dim Data() As Byte = New [Byte](fs.Length) {}
fs.Read(Data, 0, fs.Length)

Dim con As New System.Data.SqlClient.SqlConnection("workstation id=KATRA;packet size=4096;integrated security=SSPI;data source=KATRA;persist security info=False;initial catalog=Sound")
con.Open()
Dim cmd As New System.Data.SqlClient.SqlCommand("insert_SampleSoundTable_1")
cmd.Connection = con
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("@samplesound_1", Data)
cmd.ExecuteNonQuery()
con.Close()
fs.Close()
Catch ex As System.Data.SqlClient.SqlException
MsgBox(ex.Message)
End Try

End Sub


(when i push that button the file is saved in the table as binary )


What i want to do and i cant ,is to have a 3rd button and when i push it i want to play the sound files which are already
saved in the table.I dont want to play those files with media player or winamp or any other similar program.I see that there is an object in the toolbox of the vb.net ,TrackBar.
How the sound can be played by using that.Please help me.
i hope you understand me.
My english are not so good and i dont know well the vb.net.
Thank you very much.
   

- Advertisement -