日期:2014-05-18 浏览次数:20814 次
Dim con As New SqlConnection("Server=yileiw2;uid=sqlauth;pwd=sqlauth;database=pubs") Dim da As New SqlDataAdapter("Select * From pub_info", con) Dim MyCB As SqlCommandBuilder = New SqlCommandBuilder(da) Dim ds As New DataSet() da.MissingSchemaAction = MissingSchemaAction.AddWithKey con.Open() da.Fill(ds, "Pub_info") Dim fs As New FileStream _ ("C:\SomePath\MyPhoto.jpg", FileMode.OpenOrCreate, _ FileAccess.Read) Dim MyData(fs.Length) As Byte fs.Read(MyData, 0, fs.Length) fs.Close() ds.Tables("Pub_info").Rows(0)("logo") = MyData da.Update(ds, "Pub_info") fs = Nothing MyCB = Nothing ds = Nothing da = Nothing con.Close() con = Nothing Response.Write("File saved to database")
------解决方案--------------------
应该是WEB的吧
前段时间也有这个,网上很多的,可以去找一下
------解决方案--------------------
参考:
http://www.cnblogs.com/tzwhx/archive/2008/10/04/1303801.html
先取得路径,再循环把图片文件插入数据库