本帖最后由 ssfnpyu 于 2010-9-3 15:02 编辑 Local $_XinZeng_FenLei_ID
$_DuQu_Main_BaoJiaGuangLi_FenLei1 = GUICtrlRead($_Main_BaoJiaGuangLi_Combo_FenLei1)
$_DuQu_Main_BaoJiaGuangLi_FenLei2 = GUICtrlRead($_Main_BaoJiaGuangLi_Combo_FenLei2)
$_DuQu_Main_BaoJiaGuangLi_FenLei3 = GUICtrlRead($_Main_BaoJiaGuangLi_Combo_FenLei3)
$_DuQu_Main_BaoJiaGuangLi_XingHao = GUICtrlRead($_Main_BaoJiaGuangLi_Input_XingHao)
$_DuQu_Main_BaoJiaGuangLi_ChanShu = GUICtrlRead($_Main_BaoJiaGuangLi_Input_ChanShu)
$_DuQu_Main_BaoJiaGuangLi_JiaGe = GUICtrlRead($_Main_BaoJiaGuangLi_Input_JiaGe)
$_DuQu_Main_BaoJiaGuangLi_BeiZhu = GUICtrlRead($_Main_BaoJiaGuangLi_Input_BeiZhu)
$_DuQu_Main_BaoJiaGuangLi_Group = GUICtrlRead($_Main_BaoJiaGuangLi_Group)
$Rs = ObjCreate("ADODB.Recordset")
$Rs.ActiveConnection = $ObjConn
$Rs.Open("Insert Into _Andrew_BaoJiaGuangLi(FenLei,PeiJian,PinPai,XingHao,CanShu,BeiZhu,DengLu_ID) Values('" & _
"" & $_DuQu_Main_BaoJiaGuangLi_FenLei1 & "','" & $_DuQu_Main_BaoJiaGuangLi_FenLei2 & "','" & $_DuQu_Main_BaoJiaGuangLi_FenLei3 & "','" & _
"" & $_DuQu_Main_BaoJiaGuangLi_XingHao & "','" & $_DuQu_Main_BaoJiaGuangLi_ChanShu & "','" & _
"" & $_DuQu_Main_BaoJiaGuangLi_BeiZhu & "','" & $_DengLu_ZhangHao_ID & "')")
$Rs.Open("Select SCOPE_IDENTITY()")
If Not $Rs.Eof And Not $Rs.Bof Then $_XinZeng_FenLei_ID = $Rs.Fields(0).Value
$Rs.Close
我用"Select SCOPE_IDENTITY()"这句语句来获取最新加入的数据的ID。。但获取出来的值是空值。。为什么呢?
如果不能加"Select SCOPE_IDENTITY()"这句语句。。那应该要怎么获取呢? |