dbSource.Execute ("INSERT INTO #WSSTOCK  SELECT itemno as Item_No,sum(qty) as Quantity FROM STOCK IN '" & Text1.Text & "' 'foxpro 2.5;' group by itemno")

解决方案 »

  1.   

    ArmorCar老兄的办法我试过,会出错:INSERT INTO语句的语法错误。有其它办法么?
      

  2.   

    ??
     Set "select into/bulkcopy" option off and try it . 
      

  3.   

    仍然是错,应该不关这个设置的问题,因为是用insert into。
      

  4.   

    SQL Server将 # 认为非法字符
      

  5.   

    I mean set "select into/bulkcopy" option off  and use "select into #wsstock..."
      

  6.   

    I use a vfp table to test it,the following query can run on SQL. select *  into #test1 from openrowset('MSDASQL','Driver=Microsoft Visual FoxPro Driver;SourceDB=C:\;SourceType=DBF','select * from 123 where no != "2086" order by w_date')
      

  7.   

    1,#并不是非法字符,它表示创建的是一个客户端的临时库。
    2,"select into/bulkcopy" option off  我理解的意思是将前面的勾去掉,但如果去掉,是不允许运行select xxx into的,如果你的意思是勾上,那就会出现我说的错误。
    我想我之所以插入正式表可以而插入临时表出现这个问题,可能和我连接数据库的方式有关,不知道是不是这种情况下不能直接使用临时库。如果真是,那有什么办法能将.dbf导进一个sql的临时表么?(DTS应该可以,但公司禁止编程时使用)
      

  8.   

    1.I think we both know what the option "off " mean.
    2.Have you read the last post written by me?I think you can use OPENROWSET method to resolve this problem.
    3.Because the microsoft Foxpro driver is not supported on my computer,so I cannot use a table which created in Foxpro2.5 to test.But I use a dbase2 table and dbase 3 table to test the query,it can run properly.So I think the driver --Microsoft Visual FoxPro Driver CAN deal with Foxpro2.5 table.
      

  9.   

    我试过你的办法,但很奇怪,出错,提示:incorrect syntax near 'MSDASQL'
      

  10.   

    ????
    Can your query run properly in Sql server query analyse tool?
      

  11.   

    回复人: ArmorCar() (2001-10-18 11:42:05)  得0分 
    dbSource.Execute ("INSERT INTO #WSSTOCK  SELECT itemno as Item_No,sum(qty) as Quantity FROM STOCK IN '" & Text1.Text & "' 'foxpro 2.5;' group by itemno")  
    回复人: kenswind(西疯) (2001-10-18 12:02:56)  得0分 
    ArmorCar老兄的办法我试过,会出错:INSERT INTO语句的语法错误。有其它办法么?  
    回复人: ArmorCar() (2001-10-18 12:24:10)  得0分 
    ??
    Set "select into/bulkcopy" option off and try it .  
    回复人: kenswind(西疯) (2001-10-18 12:34:14)  得0分 
    仍然是错,应该不关这个设置的问题,因为是用insert into。  
    回复人: touhu(吐血) (2001-10-18 13:01:01)  得0分 
    SQL Server将 # 认为非法字符  
    回复人: ArmorCar() (2001-10-18 13:15:42)  得0分 
    I mean set "select into/bulkcopy" option off  and use "select into #wsstock..."  
    回复人: ArmorCar() (2001-10-18 13:33:12)  得0分 
    I use a vfp table to test it,the following query can run on SQL. select *  into #test1 from openrowset('MSDASQL','Driver=Microsoft Visual FoxPro Driver;SourceDB=C:\;SourceType=DBF','select * from 123 where no != "2086" order by w_date')  
    回复人: kenswind(西疯) (2001-10-18 13:38:07)  得0分 
    1,#并不是非法字符,它表示创建的是一个客户端的临时库。
    2,"select into/bulkcopy" option off  我理解的意思是将前面的勾去掉,但如果去掉,是不允许运行select xxx into的,如果你的意思是勾上,那就会出现我说的错误。
    我想我之所以插入正式表可以而插入临时表出现这个问题,可能和我连接数据库的方式有关,不知道是不是这种情况下不能直接使用临时库。如果真是,那有什么办法能将.dbf导进一个sql的临时表么?(DTS应该可以,但公司禁止编程时使用)  
    回复人: ArmorCar() (2001-10-18 15:09:26)  得0分 
    1.I think we both know what the option "off " mean.
    2.Have you read the last post written by me?I think you can use OPENROWSET method to resolve this problem.
    3.Because the microsoft Foxpro driver is not supported on my computer,so I cannot use a table which created in Foxpro2.5 to test.But I use a dbase2 table and dbase 3 table to test the query,it can run properly.So I think the driver --Microsoft Visual FoxPro Driver CAN deal with Foxpro2.5 table.  
    回复人: kenswind(西疯) (2001-10-18 15:21:28)  得0分 
    我试过你的办法,但很奇怪,出错,提示:incorrect syntax near 'MSDASQL'  
    回复人: ArmorCar() (2001-10-18 15:52:51)  得0分 
    ????
    Can your query run properly in Sql server query analyse tool?