
Новые сообщения [новые:0]
Дайджест
Горячие темы
Избранное [новые:0]
Форумы
Пользователи
Статистика
Статистика нагрузки
Мод. лог
Поиск
|
|
13.09.2007, 10:56
|
|||
|---|---|---|---|
Как сохранить на диск с помощью SaveFileDialog данных типа BLOB из ADO.NET и Microsoft Vis |
|||
|
#18+
Как сохранить на диск с помощью SaveFileDialog данных типа BLOB из ADO.NET и Microsoft Visual Basic .NET ? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
|
|
|
13.09.2007, 11:02
|
|||
|---|---|---|---|
Как сохранить на диск с помощью SaveFileDialog данных типа BLOB из ADO.NET и Microsoft Vis |
|||
|
#18+
Как сохранить на диск с помощью SaveFileDialog данных типа BLOB из ADO.NET и Microsoft Visual Basic .NET ? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
|
|
|
13.09.2007, 11:50
|
|||
|---|---|---|---|
Как сохранить на диск с помощью SaveFileDialog данных типа BLOB из ADO.NET и Microsoft Vis |
|||
|
#18+
у меня такая ситуация. форма состоит из ComboBox, две кнопки и три TextBox-a. в форме связ между таблицами идет один ко многим т.е основная таблица у меня RS а связанная Files.Таблицы Files имеет четыре поле 1-file_ID 2-file_Name 3-file_file и 4-rs_ID (для связывания с основным таблицой RS код формы: Imports System.Data.SqlClient Imports System.IO -------------------------------------------------------------------------------------------- Public Class formAdd_Files Private Sub RSBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RSBindingNavigatorSaveItem.Click Me.FilesTableAdapter.Update(Me.R__SDataSet.Files) 'TODO: This line of code loads data into the 'R__SDataSet.RS' table. You can move, or remove it, as needed. Me.RSTableAdapter.Update(Me.R__SDataSet.RS) End Sub Private Sub formAdd_Files_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'TODO: This line of code loads data into the 'R__SDataSet.Files' table. You can move, or remove it, as needed. Me.FilesTableAdapter.Fill(Me.R__SDataSet.Files) 'TODO: This line of code loads data into the 'R__SDataSet.RS' table. You can move, or remove it, as needed. Me.RSTableAdapter.Fill(Me.R__SDataSet.RS) End Sub --------------------------------------------------------------------------------------------- Private Sub Сохранить файл_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click Dim con As New SqlConnection _ ("Server=IGD-ENGEENIER;uid=sa;pwd=;database=R__S") Dim da As New SqlDataAdapter _ ("Select * From Files", con) Dim MyCB As SqlCommandBuilder = New SqlCommandBuilder(da) Dim ds As New DataSet() Dim openFileDialog1 As New OpenFileDialog() da.MissingSchemaAction = MissingSchemaAction.AddWithKey openFileDialog1.ShowDialog() Dim fs As New FileStream _ (openFileDialog1.FileName, FileMode.OpenOrCreate, _ FileAccess.Read) Dim MyData(fs.Length) As Byte fs.Read(MyData, 0, fs.Length) fs.Close() con.Open() da.Fill(ds, "Files") Dim myRow As DataRow myRow = ds.Tables("Files").NewRow() 'myRow("file_ID") = File_IDTextBox.Text myRow("rs_ID") = Rs_IDTextBox.Text myRow("file_Name") = File_NameTextBox.Text myRow("file_file") = MyData ds.Tables("Files").Rows.Add(myRow) da.Update(ds, "Files") fs = Nothing MyCB = Nothing ds = Nothing da = Nothing con.Close() con = Nothing MsgBox("Image saved to database") End Sub ----------------------------------------------------------------------------------------- Private Sub Загрузить файл_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click Dim con As New SqlConnection _ ("Server=IGD-ENGEENIER;uid=sa;pwd=;database=R__S") Dim da As New SqlDataAdapter _ ("Select * From Files", con) Dim MyCB As SqlCommandBuilder = New SqlCommandBuilder(da) Dim ds As New DataSet() Dim saveFileDialog1 As New SaveFileDialog() con.Open() da.Fill(ds, "Files") Dim myRow As DataRow myRow = ds.Tables("Files").Rows(0) Dim MyData() As Byte MyData = myRow("file_file") Dim K As Long K = UBound(MyData) ????????????здес у меня проблемы???????????? Dim fs As New FileStream _ (saveFileDialog1.FileName, FileMode.OpenOrCreate, _ FileAccess.Write) ???????????????????????????????????????????????????????? fs.Write(MyData, 0, K) fs.Close() fs = Nothing MyCB = Nothing ds = Nothing da = Nothing con.Close() con = Nothing MsgBox("Image retrieved") End Sub End Class ... |
|||
|
:
Нравится:
Не нравится:
|
|||
|
|
|
13.09.2007, 11:51
|
|||
|---|---|---|---|
Как сохранить на диск с помощью SaveFileDialog данных типа BLOB из ADO.NET и Microsoft Vis |
|||
|
#18+
у меня такая ситуация. форма состоит из ComboBox, две кнопки и три TextBox-a. в форме связ между таблицами идет один ко многим т.е основная таблица у меня RS а связанная Files.Таблицы Files имеет четыре поле 1-file_ID 2-file_Name 3-file_file и 4-rs_ID (для связывания с основным таблицой RS код формы: Imports System.Data.SqlClient Imports System.IO -------------------------------------------------------------------------------------------- Public Class formAdd_Files Private Sub RSBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RSBindingNavigatorSaveItem.Click Me.FilesTableAdapter.Update(Me.R__SDataSet.Files) 'TODO: This line of code loads data into the 'R__SDataSet.RS' table. You can move, or remove it, as needed. Me.RSTableAdapter.Update(Me.R__SDataSet.RS) End Sub Private Sub formAdd_Files_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'TODO: This line of code loads data into the 'R__SDataSet.Files' table. You can move, or remove it, as needed. Me.FilesTableAdapter.Fill(Me.R__SDataSet.Files) 'TODO: This line of code loads data into the 'R__SDataSet.RS' table. You can move, or remove it, as needed. Me.RSTableAdapter.Fill(Me.R__SDataSet.RS) End Sub --------------------------------------------------------------------------------------------- Private Sub Сохранить файл_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click Dim con As New SqlConnection _ ("Server=IGD-ENGEENIER;uid=sa;pwd=;database=R__S") Dim da As New SqlDataAdapter _ ("Select * From Files", con) Dim MyCB As SqlCommandBuilder = New SqlCommandBuilder(da) Dim ds As New DataSet() Dim openFileDialog1 As New OpenFileDialog() da.MissingSchemaAction = MissingSchemaAction.AddWithKey openFileDialog1.ShowDialog() Dim fs As New FileStream _ (openFileDialog1.FileName, FileMode.OpenOrCreate, _ FileAccess.Read) Dim MyData(fs.Length) As Byte fs.Read(MyData, 0, fs.Length) fs.Close() con.Open() da.Fill(ds, "Files") Dim myRow As DataRow myRow = ds.Tables("Files").NewRow() 'myRow("file_ID") = File_IDTextBox.Text myRow("rs_ID") = Rs_IDTextBox.Text myRow("file_Name") = File_NameTextBox.Text myRow("file_file") = MyData ds.Tables("Files").Rows.Add(myRow) da.Update(ds, "Files") fs = Nothing MyCB = Nothing ds = Nothing da = Nothing con.Close() con = Nothing MsgBox("Image saved to database") End Sub ----------------------------------------------------------------------------------------- Private Sub Загрузить файл_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2.Click Dim con As New SqlConnection _ ("Server=IGD-ENGEENIER;uid=sa;pwd=;database=R__S") Dim da As New SqlDataAdapter _ ("Select * From Files", con) Dim MyCB As SqlCommandBuilder = New SqlCommandBuilder(da) Dim ds As New DataSet() Dim saveFileDialog1 As New SaveFileDialog() con.Open() da.Fill(ds, "Files") Dim myRow As DataRow myRow = ds.Tables("Files").Rows(0) Dim MyData() As Byte MyData = myRow("file_file") Dim K As Long K = UBound(MyData) ????????????здес у меня проблемы???????????? Dim fs As New FileStream _ (saveFileDialog1.FileName, FileMode.OpenOrCreate, _ FileAccess.Write) ???????????????????????????????????????????????????????? fs.Write(MyData, 0, K) fs.Close() fs = Nothing MyCB = Nothing ds = Nothing da = Nothing con.Close() con = Nothing MsgBox("Image retrieved") End Sub End Class ... |
|||
|
:
Нравится:
Не нравится:
|
|||
|
|
|
13.09.2007, 12:19
|
|||
|---|---|---|---|
Как сохранить на диск с помощью SaveFileDialog данных типа BLOB из ADO.NET и Microsoft Vis |
|||
|
#18+
заело? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
|
|
|
13.09.2007, 13:07
|
|||
|---|---|---|---|
Как сохранить на диск с помощью SaveFileDialog данных типа BLOB из ADO.NET и Microsoft Vis |
|||
|
#18+
Как это понять? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
|
|
|
13.09.2007, 13:13
|
|||
|---|---|---|---|
Как сохранить на диск с помощью SaveFileDialog данных типа BLOB из ADO.NET и Microsoft Vis |
|||
|
#18+
... |
|||
|
:
Нравится:
Не нравится:
|
|||
|
|
|

start [/forum/topic.php?fid=17&tablet=1&tid=1352624]: |
0ms |
get settings: |
7ms |
get forum list: |
12ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
162ms |
get topic data: |
6ms |
get forum data: |
2ms |
get page messages: |
26ms |
get tp. blocked users: |
1ms |
| others: | 275ms |
| total: | 495ms |

| 0 / 0 |
