16,552
社区成员
发帖
与我相关
我的任务
分享
str = " file:///" + Application.StartupPath + "\pic\" & "'kh '" & ".jpg"
Dim mycommand As OleDbCommand = New OleDbCommand("update ks set photo= " & str, cn)
mycommand.ExecuteNonQuery()
cn.Close()
mycommand.Dispose()
MsgBox("数据初始化成功!")
Str = " file:///" + Application.StartupPath + "\pic\"
Dim mycommand As OleDbCommand = New OleDbCommand("update tableName set photo= '" & Str & "'+CInt(kh as nvarchar(100))+'.jpg'", cn)
mycommand.ExecuteNonQuery()
cn.Close()
mycommand.Dispose()
MsgBox("数据初始化成功!")
declare @t1 table(kh int , path nvarchar(200))
declare @aa nvarchar(10)
set @aa='kh'
insert into @t1 values(1,'')
insert into @t1 values(2,'')
insert into @t1 values(4,'')
insert into @t1 values(5,'')
insert into @t1 values(6,'')
select * from @t1--原数据
update @t1 set path = 'file//test/'+cast(kh as nvarchar(100))+'.jpg'
select * from @t1--更新后,新数据
Str = " file:///" + Application.StartupPath + "\pic\"
Dim mycommand As OleDbCommand = New OleDbCommand("update tableName set photo= '" & Str & "'+cast(kh as nvarchar(100))+'.jpg'", cn)
mycommand.ExecuteNonQuery()
cn.Close()
mycommand.Dispose()
MsgBox("数据初始化成功!")
Create table #a(kh int,path nvarchar(2000))
insert into #a
select 1,null union all
select 2,null union all
select 3,null union all
select 4,null union all
select 5,null union all
select 6,null union all
select 7,null union all
select 8,null
declare @Str nvarchar(1000)
set @Str='file:///F:\tyks\bin\Debug\pic\'
Update #a
set path = @Str+cast(kh as nvarchar(100))+'.jpg'
select * from #a
update ks set photo = 'file:///F:\net\net\tyks\tyks\bin\Debug\pic\'考号'.jpg
str = " file:///" + Application.StartupPath + "\pic\" & "kh.jpg"
Dim mycommand As OleDbCommand = New OleDbCommand("update ks set photo= '"&str&"'", cn)
Dim mycommand As OleDbCommand =
New OleDbCommand(String.Format("update ks set photo='{0}'",str),cn)