Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Saving data
Message
From
13/08/2003 10:36:17
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Saving data
Miscellaneous
Thread ID:
00819761
Message ID:
00819761
Views:
57
Hello everyone, can anybody tell me the best way to save richtext data into a sql server database and then retrieve the data. I have the code below to save data but I am running into an error and if I get it fixed, I still don't know if the rest of it will work. The problem occurs when dimming the filestream object. Thanks for the help.
        'Error occurs here in design mode
        Dim fs As New FileStream()
        Me.rtfTest.SaveFile(fs, RichTextBoxStreamType.RichText)
        Dim ba(fs.Length) As Byte

        fs.Read(ba, 0, fs.Length)
        fs.Close()

        Dim ado As New ADO()

        ado.strSQL = "Select imgText From zTestRichText"
        ado.CreateAdapter()
        ado.UseCommandBuilder()
        ado.CreateDataSet()

        ado.objDA.MissingSchemaAction = MissingSchemaAction.AddWithKey

        fs.Close()

        ado.OpenConnection()
        ado.objDA.Fill(ado.objDS, "MyImages")
        Dim myRow As DataRow
        myRow = ado.objDS.Tables("MyImages").NewRow()

        myRow("imgText") = ba
        ado.objDS.Tables("MyImages").Rows.Add(myRow)
        ado.objDA.Update(ado.objDS, "MyImages")
        ado.CloseConnection()

        fs = Nothing
        ado = Nothing

        MsgBox("Save Complete")
Randy Belcher
AFG Industries, Inc.
Next
Reply
Map
View

Click here to load this message in the networking platform