Misunderstanding in July (1)

xiaoxiao2021-03-06  75

I might be less likely to malfunction, all because of a question. I wanted to get all the table names in a library that day, but an unusual appearance, I think there is some puzzle. After pre-query a lot of information, I would like to ask about the MVM comrades turned to the blog before. I believe it can confirm the answer. As a result ... a small episode.

First curtain ACT 1

It is really a bad answer to get the problem. It is good to do tadoconnection.gettablenames (list: tstrings: boolean = false); "But .NET? I haven't found a good way for a few days.

Asked MVM to answer me two ways

> (1) SYNTAX> SQL = "SELECT NAME FROM MSYSOBJECTS WHERE (Name NOT LIKE 'MSYS *') and> (Type = 1 or type = 6);">. Open SQL, DB, AdoPENDYNAMIC >> I Forgot To Put In The Connection & Cursor

I have tried this method and established a query in Access, but there is a problem in prosthetic issues in ASP.NET or Delphi applications.

The answer to the MVM is not possible in ASP.NET, mostly because of permission issues. Either ASP.NET's run account (different in Win2K and Win2003) can be placed inside the Administrators group, or you can upgrade the permissions of the ASP.NET's working process in ASP.NET. I used to call WMI in ASP.NET and I encountered similar problems. It was better to upgrade the permissions with impersonate.

I don't know this impersonate because there is no time to try. So there is no trial. The project will not agree to modify the permissions.

> (2)> Found the answer in msdn .... Look for "OpenSchema Method" Works like a charm >> public sub openschemax () >> DIM CNN1 AS Adod.com> DIM RSTSCHEMA AS AdoDb.Recordset> DIM STRCNN AS String >> SET CNN1 = New Adodb.connection> STRCNN = "provider = SQLOLDB;" & _> "Data Source = srv; Initial Catalog = PUBS; user ID = sa; password =;"> cnn1.open strcnnn >> set rstSchema = cnn1.OpenSchema (adSchemaTables) >> Do Until rstSchema.EOF> Debug.Print "Table name:" & _> rstSchema TABLE_NAME & vbCr & _> "Table type:"!! & rstSchema TABLE_TYPE & vbCr> rstSchema.MoveNext > Loop> Rstschema.Close >> CNN1.Close >> End Sub

This is a method from MSDN, I found similar. Method for MVM I observe like VB instead of .NET method? Can you use in VB.NET? This method comes from (MS-Help: //ms.vscc.2003/ms.msdnqtr.2003feb.2052/ado270/htm/mdaexamples_vb02_9.htm)? The third method I found (MS-Help: / /Ms.vscc.2003/ms.msdnqtr.2003feb.2052/cpref/html/frlfsystemdataoledboledbconnectionclassgetoledbschematabletopic.htm is not. constr = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = 0712.mdb; UserId = Admin; Password =; Jet OLEDB: Database Password = xxxxxx;" Dim oldCon As OleDbConnection _ = New OleDbConnection (constr) Dim oleAd As OLEDBDataAdapter = new oledbdataadapter 'Some Operate Here

Dim schemaTable As DataTable = New DataTable Try schemaTable = oldCon.GetOleDbSchemaTable (OleDbSchemaGuid.Tables, New Object () {Nothing, Nothing, Nothing, "TABLE"}) Catch ex As Exception System.Diagnostics.Debug.Write (ex.Message) END TRY

The result is System.invalidOperationExceptionEx.Message = "invalid operation. The connection is turned off."

I use OLEDBConnection, I still can't use it. I don't know if the adoDB is in .NET? Time, there is time to continue study.

The result didn't want, this small problem was hidden. If you want to know, please see below.

转载请注明原文地址:https://www.9cbs.com/read-121079.html

New Post(0)