这个地方没错的!
当白天又一次把黑夜按翻在床上的时候,太阳就出生了……
创建表.
if object_id('table1') is not null
drop table table1
go
create table table1(
[id] int not null identity(1,1) primary key,
[name] nvarchar(60) collate chinese_prc_ci_as not null ,
[birthday] datetime
)
insert into table1([name],[birthday]) values('purana','1988-01-02')
insert into table1([name],[birthday]) values('qq','1988-05-01')
vb写程式.
Private Sub Command1_Click()
Dim con As New ADODB.Connection
Dim sql As String
con.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Password=admin;Initial Catalog=myData"
sql = "update table1 set [birthday]='" & Text1.Text & "' where [name]='purana'"
con.Execute sql
con.Close
MsgBox "success"
End Sub
在text1.text里写2000-01-01
执行成功.
sql server里日期是加单引号的.