测倒数第二行的句子。。。调试半天了,也不对。
目的:如果IDs列的数据已存在就放弃操作,不存在就写入数据
If Not FileExists(@ScriptDir & "\mdb") Then DirCreate (@ScriptDir & "\mdb")
$mdb_data_path = @ScriptDir & "\mdb\" & @MON & @MDAY & ".mdb"
$mdb_data_pwd = "passMDB"
FileDelete($mdb_data_path)
$newMdb = ObjCreate("ADOX.Catalog")
$newMdb.Create("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $mdb_data_path)
$newMdb.ActiveConnection.Close;建数据库
$addtbl = ObjCreate("ADODB.Connection")
$addtbl.open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $mdb_data_path)
$addtbl.Execute("CREATE TABLE tywb")
$addtbl.Close;建表
$addfld = ObjCreate("ADODB.Connection")
$addfld.open("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & $mdb_data_path)
$addfld.Execute("ALTER TABLE tywb ADD xu identity(1, 1) primary key,IDs int,lei char,yin char,jin char")
$addfld.Close;建列表名
$addfld = ObjCreate("ADODB.Connection")
$addfld.open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & $mdb_data_path & ";Jet Oledb:Database Password=" & $mdb_data_pwd)
$sQuery ="insert into tywb (IDs,lei,yin,jin) values('123','还账','农行','200000')"
$addfld.Execute($sQuery)
$addfld.close
$addfld = ObjCreate("ADODB.Connection")
$addfld.open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & $mdb_data_path & ";Jet Oledb:Database Password=" & $mdb_data_pwd)
$addfld.Execute("insert into tywb (IDs,lei,yin,jin) values('123','ss','ss','ss') where ('123') not in (IDs)")
$addfld.close
[ 本帖最后由 maker 于 2008-11-29 15:34 编辑 ] |