| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1609 人关注过本帖
标题:利用VB在数据库SQL中存取图片
只看楼主 加入收藏
文彦波
Rank: 1
等 级:新手上路
帖 子:21
专家分:0
注 册:2009-7-6
结帖率:85.71%
收藏
 问题点数:0 回复次数:9 
利用VB在数据库SQL中存取图片
错误提示没有与可信任的数据库相连接 ,高手帮帮忙找出原因所在,我快要崩溃了,如果您有源代码请指教一个,万分感谢。
Imports
Imports System.Drawing.Printing
Imports System.Data.SqlClient


Public Class Form1
    Inherits System.Windows.Forms.Form
    Dim sqlCon As New SqlConnection("DATA SOURCE=202.118.12.169;INITIAL CATALOG=pubs;UID=SA;PWD=") 'DATA SOURCE后跟本机的ip或local,INITIAL CATALOG后为数据库的名字,UID后是sa,PWD后是密码

    Dim cn As SqlClient.SqlConnection

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    'Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
    '    If disposing Then
    '        If Not (components Is Nothing) Then
    '            components.Dispose()
    '        End If
    '    End If
    '    MyBase.Dispose(disposing)
    'End Sub

    'Required by the Windows Form Designer
    Private component As

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
    Friend WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection
    Friend WithEvents SqlCommand1 As System.Data.SqlClient.SqlCommand
    Friend WithEvents Button3 As System.Windows.Forms.Button
    Friend WithEvents Button4 As System.Windows.Forms.Button
    Friend WithEvents Button5 As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub Initialize()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.TextBox1 = New System.Windows.Forms.TextBox()
        Me.PictureBox1 = New System.Windows.Forms.PictureBox()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.Button2 = New System.Windows.Forms.Button()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection()
        Me.SqlCommand1 = New System.Data.SqlClient.SqlCommand()
        Me.Button3 = New System.Windows.Forms.Button()
        Me.Button4 = New System.Windows.Forms.Button()
        Me.Button5 = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(15, 19)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(80, 24)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "姓名:"
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(11, 64)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(80, 20)
        Me.Label2.TabIndex = 1
        Me.Label2.Text = "图片"
        '
        'TextBox1
        '
        Me.TextBox1.Location = New System.Drawing.Point(75, 16)
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.Size = New System.Drawing.Size(173, 20)
        Me.TextBox1.TabIndex = 2
        Me.TextBox1.Text = ""
        '
        'PictureBox1
        '
        Me.PictureBox1.Location = New System.Drawing.Point(68, 48)
        Me.PictureBox1.Name = "PictureBox1"
        Me.PictureBox1.Size = New System.Drawing.Size(376, 222)
        Me.PictureBox1.TabIndex = 3
        Me.PictureBox1.TabStop = False
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(278, 13)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(96, 26)
        Me.Button1.TabIndex = 4
        Me.Button1.Text = "浏览图片…"
        '
        'Button2
        '
        Me.Button2.Location = New System.Drawing.Point(57, 277)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(100, 32)
        Me.Button2.TabIndex = 5
        Me.Button2.Text = "添加到数据库"
        '
        'SqlConnection1
        '
        Me.SqlConnection1.ConnectionString = "Data Source=.;Initial Catalog=mxh;User Id=sa;Password=;"
        '
        'SqlCommand1
        '
        Me. = "dbo.[sp_InsertPhoto]"
        Me. = System.
        Me.SqlCommand1.Connection = Me.SqlConnection1
        Me.SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@RETURN_VALUE", _
            System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, _
            False, CType(10, Byte), CType(0, Byte), "", System.Data.DataRowVersion.Current, Nothing))
        Me.SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@name", _
            System.Data.SqlDbType.VarChar, 50))
        Me.SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@image", _
            System.Data.SqlDbType.VarBinary, 2147483647))
        '
        'Button3
        '
        Me.Button3.Location = New System.Drawing.Point(265, 277)
        Me.Button3.Name = "Button3"
        Me.Button3.Size = New System.Drawing.Size(79, 32)
        Me.Button3.TabIndex = 6
        Me.Button3.Text = "显示记录"
        '
        'Button4
        '
        Me.Button4.Location = New System.Drawing.Point(362, 277)
        Me.Button4.Name = "Button4"
        Me.Button4.Size = New System.Drawing.Size(72, 32)
        Me.Button4.TabIndex = 7
        Me.Button4.Text = "退出"
        '
        'Button5
        '
        Me.Button5.Location = New System.Drawing.Point(167, 277)
        Me.Button5.Name = "Button5"
        Me.Button5.Size = New System.Drawing.Size(85, 32)
        Me.Button5.TabIndex = 8
        Me.Button5.Text = "删除该记录"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(491, 324)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.PictureBox1, _
            Me.Button5, Me.Button4, Me.Button3, Me.Button2, Me.Button1, Me.TextBox1, Me.Label1, Me.Label2})
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

#End Region
    'Browse Button
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
      Handles Button1.Click
        'Display Picture File
        OpenFileDialog1.InitialDirectory = "d:\pic"
        OpenFileDialog1.DefaultExt = "gif"
        OpenFileDialog1.Filter = "Bmp Files(*.bmp)|*.bmp|Gif Files(*.gif)|*.gif|Jpg Files(*.jpg)|*.jpg"
        OpenFileDialog1.ShowDialog()
        PictureBox1.Image = Image.FromFile(OpenFileDialog1.FileName)
    End Sub

    'Add Button
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
      Handles Button2.Click
        ' To Insert Image
        Dim st As New FileStream(OpenFileDialog1.FileName, FileMode.Open, FileAccess.Read)
        Dim s As String = TextBox1.Text
        Dim mbr As BinaryReader = New BinaryReader(st)
        Dim buffer(st.Length) As Byte
        mbr.Read(buffer, 0, CInt(st.Length))
        st.Close()
        InsertImage(buffer, s)
    End Sub

    'Function For Inserting in the Procdeure in the Database
    Public Function InsertImage(ByRef buffer, ByVal str)
        cn = New SqlClient.SqlConnection(SqlConnection1.ConnectionString)
        cn.Open()
        Dim cmd As New SqlClient.SqlCommand("sp_InsertPhoto", cn)
         = CommandType.StoredProcedure
        cmd.Parameters.Add("@name", SqlDbType.VarChar).Value = TextBox1.Text
        cmd.Parameters.Add("@image", SqlDbType.Image).Value = buffer
        cmd.ExecuteNonQuery()
        MsgBox("Image inserted")
        cn.Close()
    End Function

    'Function to Display Image
    Private Sub ShowImage(ByVal s As String)
        cn = New SqlClient.SqlConnection(SqlConnection1.ConnectionString)
        cn.Open()
        Dim str As String = "SELECT photo FROM Photos WHERE name='" & s & "'"
        Dim cmd As New SqlClient.SqlCommand(str, cn)
        TextBox1.Text = s
        Dim b() As Byte
        b = cmd.ExecuteScalar()
        If (b.Length > 0) Then
            Dim stream As New MemoryStream(b, True)
            stream.Write(b, 0, b.Length)
            DrawToScale(New Bitmap(stream))
            stream.Close()
        End If
        cn.Close()
    End Sub

    'Function to Create Instance For the Image From the Buffer
    Private Sub DrawToScale(ByVal bmp As Image)
        PictureBox1.Image = New Bitmap(bmp)
    End Sub

    '显示处理
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
      Handles Button3.Click
        Dim i As String = InputBox("请输入名字:")
        ShowImage(i)
    End Sub

    '退出处理
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
      Handles Button4.Click
        Me.Dispose()
    End Sub

    '删除处理
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
      Handles Button5.Click
        cn = New SqlClient.SqlConnection(SqlConnection1.ConnectionString)
        cn.Open()
        Dim s As String = InputBox("请输入要删除的名字:")
        Dim cmd As New SqlClient.SqlCommand("delete from photos where name='" & s & "'", cn)
        cmd.ExecuteNonQuery()
        MsgBox("Image deleted")
        cn.Close()
    End Sub

  
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If sqlCon.State = ConnectionState.Closed Then
            sqlCon.Open()
        End If
    End Sub
End Class
搜索更多相关主题的帖子: SQL 数据库 存取 
2009-11-13 09:27
不说也罢
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:贵宾
威 望:39
帖 子:1481
专家分:4989
注 册:2007-10-7
收藏
得分:0 
这里有一个例子:
首先,在SQLSERVER的查询分析器里运行下面代码创建一个表Photos和一个存储过程sp_InsertPhoto:
程序代码:
CREATE TABLE Photos (
    [name] varchar(50),
    [photo] image NULL
)
GO

CREATE PROCEDURE sp_InsertPhoto
    @name AS VARCHAR(50),
    @image AS IMAGE
    AS
INSERT INTO Photos ([name],  [photo])
VALUES (@name, @image)
GO

然后新建一个项目,直接复制下面代码运行即可:


程序代码:
Imports  Class Form1
    Inherits System.Windows.Forms.Form
    Dim cn As SqlClient.SqlConnection

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As  'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents Button2 As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
    Friend WithEvents SqlConnection1 As System.Data.SqlClient.SqlConnection
    Friend WithEvents SqlCommand1 As System.Data.SqlClient.SqlCommand
    Friend WithEvents Button3 As System.Windows.Forms.Button
    Friend WithEvents Button4 As System.Windows.Forms.Button
    Friend WithEvents Button5 As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.TextBox1 = New System.Windows.Forms.TextBox()
        Me.PictureBox1 = New System.Windows.Forms.PictureBox()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.Button2 = New System.Windows.Forms.Button()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.SqlConnection1 = New System.Data.SqlClient.SqlConnection()
        Me.SqlCommand1 = New System.Data.SqlClient.SqlCommand()
        Me.Button3 = New System.Windows.Forms.Button()
        Me.Button4 = New System.Windows.Forms.Button()
        Me.Button5 = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(15, 19)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(80, 24)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "姓名:"
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(11, 64)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(80, 20)
        Me.Label2.TabIndex = 1
        Me.Label2.Text = "图片"
        '
        'TextBox1
        '
        Me.TextBox1.Location = New System.Drawing.Point(75, 16)
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.Size = New System.Drawing.Size(173, 20)
        Me.TextBox1.TabIndex = 2
        Me.TextBox1.Text = ""
        '
        'PictureBox1
        '
        Me.PictureBox1.Location = New System.Drawing.Point(68, 48)
        Me.PictureBox1.Name = "PictureBox1"
        Me.PictureBox1.Size = New System.Drawing.Size(376, 222)
        Me.PictureBox1.TabIndex = 3
        Me.PictureBox1.TabStop = False
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(278, 13)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(96, 26)
        Me.Button1.TabIndex = 4
        Me.Button1.Text = "浏览图片…"
        '
        'Button2
        '
        Me.Button2.Location = New System.Drawing.Point(57, 277)
        Me.Button2.Name = "Button2"
        Me.Button2.Size = New System.Drawing.Size(100, 32)
        Me.Button2.TabIndex = 5
        Me.Button2.Text = "添加到数据库"
        '
        'SqlConnection1
        '下面一行是连接SQLSERVER代码“Data Source=.(也可写成“(local) 或(220.168.25.12)”);Initial Catalog=数据库名称;User Id=sa(默认);Password=默认为空;"
        Me.SqlConnection1.ConnectionString = "Data Source=.;Initial Catalog=PcikServer;User Id=sa;Password=;"
        '
        'SqlCommand1
        '
        Me. = "dbo.[sp_InsertPhoto]"
        Me. = System. = Me.SqlConnection1
        Me.SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@RETURN_VALUE", _
            System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.ReturnValue, _
            False, CType(10, Byte), CType(0, Byte), "", System.Data.DataRowVersion.Current, Nothing))
        Me.SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@name", _
            System.Data.SqlDbType.VarChar, 50))
        Me.SqlCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@image", _
            System.Data.SqlDbType.VarBinary, 2147483647))
        '
        'Button3
        '
        Me.Button3.Location = New System.Drawing.Point(265, 277)
        Me.Button3.Name = "Button3"
        Me.Button3.Size = New System.Drawing.Size(79, 32)
        Me.Button3.TabIndex = 6
        Me.Button3.Text = "显示记录"
        '
        'Button4
        '
        Me.Button4.Location = New System.Drawing.Point(362, 277)
        Me.Button4.Name = "Button4"
        Me.Button4.Size = New System.Drawing.Size(72, 32)
        Me.Button4.TabIndex = 7
        Me.Button4.Text = "退出"
        '
        'Button5
        '
        Me.Button5.Location = New System.Drawing.Point(167, 277)
        Me.Button5.Name = "Button5"
        Me.Button5.Size = New System.Drawing.Size(85, 32)
        Me.Button5.TabIndex = 8
        Me.Button5.Text = "删除该记录"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(491, 324)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.PictureBox1, _
            Me.Button5, Me.Button4, Me.Button3, Me.Button2, Me.Button1, Me.TextBox1, Me.Label1, Me.Label2})
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

#End Region
    'Browse Button
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
      Handles Button1.Click
        'Display Picture File
        OpenFileDialog1.InitialDirectory = "d:\pic"
        OpenFileDialog1.DefaultExt = "gif"
        OpenFileDialog1.Filter = "Bmp Files(*.bmp)|*.bmp|Gif Files(*.gif)|*.gif|Jpg Files(*.jpg)|*.jpg"
        OpenFileDialog1.ShowDialog()
        PictureBox1.Image = Image.FromFile(OpenFileDialog1.FileName)
    End Sub

    'Add Button
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
      Handles Button2.Click
        ' To Insert Image
        Dim st As New FileStream(OpenFileDialog1.FileName, FileMode.Open, FileAccess.Read)
        Dim s As String = TextBox1.Text
        Dim mbr As BinaryReader = New BinaryReader(st)
        Dim buffer(st.Length) As Byte
        mbr.Read(buffer, 0, CInt(st.Length))
        st.Close()
        InsertImage(buffer, s)
    End Sub

    'Function For Inserting in the Procdeure in the Database
    Public Function InsertImage(ByRef buffer, ByVal str)
        cn = New SqlClient.SqlConnection(SqlConnection1.ConnectionString)
        cn.Open()
        Dim cmd As New SqlClient.SqlCommand("sp_InsertPhoto", cn)
         = CommandType.StoredProcedure
        cmd.Parameters.Add("@name", SqlDbType.VarChar).Value = TextBox1.Text
        cmd.Parameters.Add("@image", SqlDbType.Image).Value = buffer
        cmd.ExecuteNonQuery()
        MsgBox("存储图像成功")
        cn.Close()
    End Function

    'Function to Display Image
    Private Sub ShowImage(ByVal s As String)
        cn = New SqlClient.SqlConnection(SqlConnection1.ConnectionString)
        cn.Open()
        Dim str As String = "SELECT photo FROM Photos WHERE name='" & s & "'"
        Dim cmd As New SqlClient.SqlCommand(str, cn)
        TextBox1.Text = s
        Dim b() As Byte
        b = cmd.ExecuteScalar()
        If (b.Length > 0) Then
            Dim stream As New MemoryStream(b, True)
            stream.Write(b, 0, b.Length)
            DrawToScale(New Bitmap(stream))
            stream.Close()
        End If
        cn.Close()
    End Sub

    'Function to Create Instance For the Image From the Buffer
    Private Sub DrawToScale(ByVal bmp As Image)
        PictureBox1.Image = New Bitmap(bmp)
    End Sub

    '显示处理
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
      Handles Button3.Click
        Dim i As String = InputBox("请输入名字:")
        ShowImage(i)
    End Sub

    '退出处理
    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
      Handles Button4.Click
        Me.Dispose()
    End Sub

    '删除处理
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
      Handles Button5.Click
        cn = New SqlClient.SqlConnection(SqlConnection1.ConnectionString)
        cn.Open()
        Dim s As String = InputBox("请输入要删除的名字:")
        Dim cmd As New SqlClient.SqlCommand("delete from photos where name='" & s & "'", cn)
        cmd.ExecuteNonQuery()
        MsgBox("图像已被删除")
        cn.Close()
    End Sub
End Class


===================================================
讨厌C#的行尾的小尾巴;和一对大括号{ }
===================================================
2009-11-14 12:08
文彦波
Rank: 1
等 级:新手上路
帖 子:21
专家分:0
注 册:2009-7-6
收藏
得分:0 
万分谢谢,不过还是实现不了,显示是一样的无法与数据库相连接。
2009-11-15 11:08
文彦波
Rank: 1
等 级:新手上路
帖 子:21
专家分:0
注 册:2009-7-6
收藏
得分:0 
在Form1里的控件怎么没有没有显示呢 帮帮忙看一下 谢谢
2009-11-15 11:16
不说也罢
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:贵宾
威 望:39
帖 子:1481
专家分:4989
注 册:2007-10-7
收藏
得分:0 
给你的例子是完全没有问题的

第一步创建表和存储过程你做了么?
如果做完了,在SQLSERVER中看一看刚创建的表“Photos”是在哪一个数据库中,将数据库名称替换下面的红色代码:

Me.SqlConnection1.ConnectionString = "Data Source=.;Initial Catalog=PcikServer;User Id=sa;Password=;"

===================================================
讨厌C#的行尾的小尾巴;和一对大括号{ }
===================================================
2009-11-15 11:17
文彦波
Rank: 1
等 级:新手上路
帖 子:21
专家分:0
注 册:2009-7-6
收藏
得分:0 
在控制器面板里怎么显示不出来控件呢 往里面添加 它又提示存在, 麻烦了 再帮我看看 多谢了
2009-11-18 10:06
不说也罢
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:贵宾
威 望:39
帖 子:1481
专家分:4989
注 册:2007-10-7
收藏
得分:0 
就你的问题,发一个示例工程给你(VB2008的哦,版本低了可能打不开)

然后请按5楼提示进行调试

WindowsApplication2.rar (115.34 KB)





.

===================================================
讨厌C#的行尾的小尾巴;和一对大括号{ }
===================================================
2009-11-18 12:46
Knocker
Rank: 8Rank: 8
等 级:贵宾
威 望:47
帖 子:10454
专家分:603
注 册:2004-6-1
收藏
得分:0 
楼上莫非是阿姨?

九洲方除百尺冰,映秀又遭蛮牛耕。汽笛嘶鸣国旗半,哀伤尽处是重生。     -老K
治国就是治吏。礼义廉耻,国之四维。四维不张,国之不国。   -毛泽东
2009-11-19 20:49
文彦波
Rank: 1
等 级:新手上路
帖 子:21
专家分:0
注 册:2009-7-6
收藏
得分:0 
回复 5楼 不说也罢
我明白我的问题所在了,我用的是SQL2000,您给的程序使用2005做的,所以实现不了,能否再帮忙改一下,多谢。
2009-11-24 11:12
wei855198
Rank: 8Rank: 8
等 级:蝙蝠侠
威 望:5
帖 子:228
专家分:944
注 册:2009-4-24
收藏
得分:0 
学习学习

护肤小店 http://mina2010.
靓装小店 http://liangliyizu2010.
2010-04-10 19:13
快速回复:利用VB在数据库SQL中存取图片
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.087219 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved