我写了一个小的提交程序,但是我不明白为什么我提交时没有任何提示错误或者不成功?
<%@import namespace="system.data.sqlclient"%>
<%@import namespace="system.data.oledb"%>
<%@import namespace="system.data"%>
<%@ Page Language="vb" debug="true" %>
<script language="vb" runat="server">
sub page_load(sender as object,e as eventargs)
if session("ad_name")="" then
response.redirect("index.aspx")
end if
end sub
Sub Enter_click(sender as object,e as eventargs)
if page.isvalid then
dim conn as new OLEDBconnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source="&server.mappath("db1.mdb"))
dim ad_name as string=session("ad_name")

解决方案 »

  1.   

    'no1
    dim no1 as string
    dim i as integer
    for i=0 to chk1.items.count-1
    if chk1.items(i).selected=true then
    no1=no1 & chk1.items(i).text & ", "
    end if
    next
    'no3
    dim no3 as string
    for i=0 to chk3.items.count-1
    if chk3.items(i).selected=true then
    no3=no3 & chk3.items(i).text & ", "
    end if
    next
    'no4
    dim no4 as string
    for i=0 to chk4.items.count-1
    if chk4.items(i).selected=true then
    no4=no4 & chk4.items(i).text & ", "
    end if
    next
    'no5
    dim no5 as string
    for i=0 to chk5.items.count-1
    if chk5.items(i).selected=true then
    no5=no5 & chk5.items(i).text & ", "
    end if
    next
    'no6
    dim no6 as string
    for i=0 to chk6.items.count-1
    if chk6.items(i).selected=true then
    no6=no6 & chk6.items(i).text & ", "
    end if
    next
    'no7
    dim no7 as string
    for i=0 to chk7.items.count-1
    if chk7.items(i).selected=true then
    no7=no7 & chk7.items(i).text & ", "
    end if
    next
    'no8
    dim no8 as string
    for i=0 to chk8.items.count-1
    if chk8.items(i).selected=true then
    no8=no8 & chk8.items(i).text & ", "
    end if
    next
    '判断备注结果
    dim no9 as string
    no9="购买卡:"+txt5.text+"还向用户推荐了:"+qt6.text+"产品。"+"还成功营销了:"+qt7.text+"产品。"+"用户还有意向:"+qt8.text+"产品。"+"备注:"+txt9.text
    dim in_main as new OLEDBcommand("insert into main(no1,no2_tel,no3,no4,no5,no6,no7,no8,no9,ad_name) value ("+no1.tostring+","+txt_tel.text+","+no3.tostring+","+no4.tostring+","+no5.tostring+","+no6.tostring+","+no7.tostring+","+no8.tostring+","+no9.tostring+","+ad_name.tostring+")",conn)
    dim in_user as new OLEDBcommand("insert into user(no2_tel,no2_name,no2_time,no2_about) value ("+txt_tel.text+","+txt_username.text+","+txt_date.text+","+ser_type.selecteditem.value+")",conn)
    Dim Exp As Exception
    Try
    '执行操作,插入记录
    conn.open()                             
    in_main.ExecuteNonQuery()
    in_user.ExecuteNonQuery()
    conn.close()                            
    Response.Redirect("index.html")         '正常添加后,返回首页
    Catch Exp 
    message.Text="发生错误,没有正常插入记录"
    End Try
    end ifEnd Sub </script>