我做的程序是从文件读数据,然后插入到数据库中,刚调好程序时运行还是很快的,几百条数据马上就插入成功了。但是现在一执行就死掉了,数据库中能插入一些数据但很慢。不明白什么原因。没修改什么,只是有单条数据有问题,调试过很多次。我怀疑是立即窗口总启动的原因。但关掉也不行,谁遇到过这个问题阿,帮忙看看问题在哪里。

解决方案 »

  1.   

    太长了阿,只能贴sql语句了
    strsql = "insert into tb_thesis(serial_number,author,author_spell,id,college,dept,major,answer_date,degree_level,tutor1_name,tutor1_name_spell,tutor1_dept,tutor2_name,tutor2_name_spell,tutor2_dept,secret_level,title,title_spell,equ_title,keyword1,keyword2,keyword3,keyword4,keyword5,"
       strsql=strsql& "abs_cn,abs_fore_lang,abs_fore,page_no,doc_height,ref_doc_amount,ill_amount,table_amount,classfication_no,classfication_no2,file_path,catalog_sign,lib_index)  values('"
             strsql = strsql & Trim(serial_number) & "','" & Trim(author) & "','" & Trim(author_spell) & "','" & Trim(id) & "','" & Trim(college) & "','" & Trim(dept) & "','" & Trim(major) & "','" & Format(year & "/" & month & "/" & day, "YYYY-MM-DD") & "','" & Trim(degree_level) & "','" & Trim(tutor1_name) & "','" & Trim(tutor1_name_spell) & "','"
             strsql = strsql & Trim(tutor1_dept) & "','" & Trim(tutor2_name) & "','" & Trim(tutor2_name_spell) & "','" & Trim(tutor2_dept) & "','" & Trim(secret_level) & "','" & Trim(Replace(title, "'", "''")) & "','" & Trim(Replace(title_spell, "'", "''")) & "','" & Trim(Replace(equ_title, "'", "''")) & "','"
             strsql = strsql & Trim(keyword1) & "','" & Trim(keyword2) & "','" & Trim(keyword3) & "','" & Trim(keyword4) & "','" & Trim(keyword5) & "','" & Trim(Replace(abs_cn, "'", "''")) & "','" & Trim(abs_fore_lang) & "','"
             strsql = strsql & Trim(Replace(abs_fore, "'", "''")) & "'," & page_no & "," & doc_height & "," & ref_doc_amount & "," & ill_amount & "," & table_amount & ",'" & classfication_no & "','" & classfication_no2 & "','" & Left(answer_date, 4) & id & "','" & "1" & "','" & Trim(lib_index) & "')"
             'MsgBox (strsql)
             cnn.Execute (strsql)
    语句长了点,而且每个字段数据得到都要进行小循还。但刚调试好时很快的,不会是立即窗口的原因吧?
      

  2.   

    你的源文件是什么格式?如果是数据库引擎支持的内部数据库格式(TXT、Excel),可以直接使用
    Insert into tb_thesis select * from tablename ...
      

  3.   

    我得源文件是图书馆专用的marc格式,得一条一条按地址读出来得