扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:佚名 来源:yesky 2007年10月15日
关键字:
SQL Server7的用法 Private Sub Command1_Click() Dim strmResults As New ADODB.Stream Dim cn As New ADODB.Connection Dim cmd As New ADODB.Command Dim cnstr As String cnstr = "Provider = SQLOLEDB.1;Password=121231;Persist Security Info=True;User ID=sa;Initial Catalog=zydb;Data Source=wzsswz" cn.ConnectionString = cnstr cn.Open Set cmd.ActiveConnection = cn cmd.CommandText = "select * from company for XML auto" strmResults.Open cmd.Properties("Output Stream").Value = strmResults cmd.Properties("xml root") = "root" cmd.Execute , , adExecuteStream strmResults.Position = 0 strmResults.SaveToFile App.Path & "\outfile.xml" strmResults.Close Set strmResults = Nothing End Sub 2000的用select * from company for XML auto就可以了 Option Explicit Dim conDB As New ADODB.Connection Private Sub cmdGetData_Click() ' Get inventory data Dim rsInventory As New ADODB.Recordset Dim stmInventory As New ADODB.Stream ' set db connection conDB.ConnectionString = ("Provider=SQLOLEDB.1;Server=Pinatubo;User ID=training; PWD=password;Initial Catalog=XMLTraining;") conDB.Open ' set recordset rsInventory.Open "tblInventory", conDB, adOpenDynamic, adLockOptimistic rsInventory.Save stmInventory, adPersistXML ' Save ADO XML to file stmInventory.SaveToFile App.Path & "\inventory.xml", adSaveCreateOverWrite ' dispaly xml file to UI wbXML.Navigate App.Path & "\inventory.xml" ' close database connection conDB.Close End Sub Private Sub cmdGetDetail_Click() ' Get product detail Dim rsProductDetail As New ADODB.Recordset Dim stmProduct As New ADODB.Stream ' Set connection string conDB.ConnectionString = ("Provider=SQLOLEDB.1;Server=Pinatubo;User ID=training; PWD=password;Initial Catalog=XMLTraining;") conDB.Open ' set recordset rsProductDetail.Open "SELECT *, tblProductDetail.* FROM tblInventory INNER JOIN " & _ "tblProductDetail ON tblInventory.fldProductID = tblProductDetail." & _ "fldProductID", conDB, adOpenDynamic, adPersistXML rsProductDetail.Save stmProduct, adPersistXML ' Save ADO XML file to disk stmProduct.SaveToFile App.Path & "\ProductDetail.xml", adSaveCreateOverWrite ' Load xml document in UI wbXML.Navigate App.Path & "\ProductDetail.xml" ' Close database connection string conDB.Close End Sub 在.NET中就方面多了 select * from table for xml auto |
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long Const SW_SHOWNORMAL = 1 Const WM_CLOSE = &H10 Const gcClassnameMSWord = "OpusApp" Const gcClassnameMSExcel = "XLMAIN" Const gcClassnameMSIExplorer = "IEFrame" Const gcClassnameMSVBasic = "wndclass_desked_gsk" Const gcClassnameNotePad = "Notepad" Const gcClassnameMyVBApp = "ThunderForm" Private Sub Form_Load() Dim WinWnd As Long, Ret As String, RetVal As Long, lpClassName As String 'Search the window WinWnd = FindWindow(vbNullString, "Microsoft Access") If WinWnd = 0 Then MsgBox "Couldn't find the window ...": Exit Sub 'Show the window ShowWindow WinWnd, SW_SHOWNORMAL 'Post a message to the window to close itself PostMessage WinWnd, WM_CLOSE, 0&, 0& End Sub |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者