请教:
EXEC master..xp_cmdshell 'bcp "select * from pubs..authors" queryout c:\1.txt -c -tlq'
这个语句在VB中当成一个字符串该怎么写?
也就是说,str=这个语句。

解决方案 »

  1.   

    Try:str="EXEC master..xp_cmdshell 'bcp \"select * from pubs..authors\" queryout c:\1.txt -c -tlq'"
      

  2.   

    to: paoluo(一天到晚游泳的鱼) 
    不行,不认.
      

  3.   

    Private Sub Command1_Click()
        Dim str1 As String
        str1 = "EXEC master..xp_cmdshell 'bcp ""select * from pubs..authors""  "
        str1 = str1 & "queryout c:\1.txt -c -tlq'"
        MsgBox str1
    End Sub
      

  4.   

    str = "EXEC master..xp_cmdshell 'bcp ""select * from pubs..authors"" queryout c:\1.txt -c -tlq'"
      

  5.   

    \"是C#的轉億符,看來VB不同。:)
      

  6.   

    to: wwh999(印钞机的卖 V2.0...发梦ing) 
    能给我详细地剖析str1吗?
    就是这个:"EXEC master..xp_cmdshell 'bcp ""select * from pubs..authors""  "
    我觉得:"EXEC master..xp_cmdshell 'bcp "这是个字符串,后面的就不是很明白了.还望指点.谢谢
      

  7.   

    你用第二句就可以了,我那樣寫是轉行方便:
    str = "EXEC master..xp_cmdshell 'bcp ""select * from pubs..authors"" queryout c:\1.txt -c -tlq'"
      

  8.   

    VB中字符串內,一個"用兩個""來代替。如果SQL的''代替'.
      

  9.   

    VB中字符串內,一個"用兩個""來代替。如果SQL的''代替'.
    严重同意。