In my previous work, I needed a brand new Access database. I could copy the database, or put the new database into the resource. I felt uncomfortable when I released the new database, or dynamic generation.
To generate a database, you must use ADO to add a reference first.
Using System. IO;
Using System. Data. OleDb; // connect to the Access Database
Using ADOX;
// Reference COM: Microsoft ADO Ext. 2.8 for DDL and Security
// Add referenc
[Vb/VBA] SQL operation Excel
1. Add reference
(1) Microsoft Active Data Objects 2.8 Library
(2) Microsoft ADO Ext. 2.8 for DDL and security
2. Use ADOX to connect to an Excel file
Dim cat as ADOX. catalog dim TBL as ADOX. table dim Col as ADOX. column dim cmd as ADODB. command dim RS as recordset set cat = ne
+1, "dbo"). Name);
}
}
}
}
2, ADOX
ADOX is the ADO Extensions for DDL and security, which is an extension of Microsoft's ADO technology, which we can use to manipulate the structure of the database. It is a COM component that is expected to add some functionality to ADOX later in the ado.net. If you need some information about
Although we can create a database from the designer, we can also create a database in the ASP's code, and let's take a look at how to create a database in ASP.
To create a database in ASP, we need to use ADOX (Microsoft ADO Extensions for DDL and security), the extension of this ADO can help us to create and modify database structure information, also includes the database object's secure policy. It appears with ADO 2.1, so it can work on most Window
to create databases and data tables. But sometimes we need to use this method. let's solve this problem.2: ADO and ADOXLet's start with a simple understanding of ADO and ADOX. In VB6, when using ADO to develop database applications, we need to reference the object library "Microsoft ActiveX Data Objects 2.5 library", which is short for ADO, it is the core object group of the VB6 database and is also the object library frequently referenced by VB Data
same version of the component library, depending on the version of Office you installed.
Sample code:
public static void Createexcelfile ()
{
string FileName = ' C://aa.xls ';
Missing miss = Missing.Value;
Excel.Application m_objexcel = new Excel.Application ();
M_objexcel.visible = false;
Excel.Workbooks m_objbooks = (excel.workbooks) m_objexcel.workbooks;
Excel.Workbook m_objbook = (Excel.Workbook) (M_objbooks.add (Miss));
m_objBook.SaveAs (FileName, Miss, Miss, Miss, M
table.In addition, I am at a limited level. If you are not doing anything, please make an axe. Start with the question.
This article introduces the basic knowledge of C # accessing and operating the Access database, and provides a related routine. C # ADO. NET cannot create a new ACCESS (MDB) database by programming, so it can only use ADOX as the link library from COM for operations.The main knowledge points are as follows:Using System. Data. OleDb;
used in combination with the CreateTableDef method. At present, many books and magazines have mentioned this method, this article will not talk about it anymore. However, if you are using the latest database access interface technology ADO, you have found that there are no articles in books and magazines about how to use code to create databases and data tables. But sometimes we need to use this method. let's solve this problem.2: ADO and ADOXLet's start with a simple understanding of ADO and
specified databaseSqldmo. _ database DB = server. Databases. Item (I + 1, "DBO ");// Obtain all tables in the specified databaseFor (Int J = 0; j {MessageBox. Show (db. Tables. Item (J + 1, "DBO"). Name );}}}}
2. ADOX
ADOX is ADO extensions for DDL and security. It is an extension of Microsoft's ADO technology. We can use it to operate the database structure. It is a COM component. It is estimated that
databaseSQLDMO. _ Database db = Server. Databases. Item (I + 1, "dbo ");// Obtain all tables in the specified databaseFor (int j = 0; j {MessageBox. Show (db. Tables. Item (j + 1, "dbo"). Name );}}}}
2. ADOX
ADOX is ADO extensions for DDL and security. It is an extension of Microsoft's ADO technology. We can use it to operate the database structure. It is a COM component. It is estimated that some
specified databaseSqldmo. _ database DB = server. Databases. Item (I + 1, "DBO ");// Obtain all tables in the specified databaseFor (Int J = 0; j {MessageBox. Show (db. Tables. Item (J + 1, "DBO"). Name );}}}}
2. ADOX
ADOX is ADO extensions for DDL and security. It is an extension of Microsoft's ADO technology. We can use it to operate the database structure. It is a COM component. It is estimated that som
specified databaseSqldmo. _ database DB = server. Databases. Item (I + 1, "DBO ");// Obtain all tables in the specified databaseFor (Int J = 0; j {MessageBox. Show (db. Tables. Item (J + 1, "DBO"). Name );}}}}
2. ADOX
ADOX is ADO extensions for DDL and security. It is an extension of Microsoft's ADO technology. We can use it to operate the database structure. It is a COM component. It is estimated that som
(strservername, struser, strpwd );// Traverse all databases to obtain the specified databaseFor (INT I = 0; I {// Determine whether the current database is a specified databaseIf (server. Databases. Item (I + 1, "DBO"). Name = strdatabase){// Obtain the specified databaseSqldmo. _ database DB = server. Databases. Item (I + 1, "DBO ");// Obtain all tables in the specified databaseFor (Int J = 0; j {MessageBox. Show (db. Tables. Item (J + 1, "DBO"). Name );}}}}
2.
xml| Data | database
A Review of Remote Database administer
A few years ago, the Cgi-bin module was used as a remote management database. Now, Cgi-bin is being used more and less because it runs slowly and is difficult to maintain.
In recent years, the Component Object Model (COM) has been widely used, unfortunately, the registration of COM components on the virtual host is a very cumbersome thing.
On the. NET or Java EE platform, we can easily develop n-tier structure WEB appli
How to use c # To operate ACCESS databases: Microsoft ACCESS is not available at hand, and how to create a database is still simple. first, reference C: ProgramFilesCommonFilesSystemadomsadox. dll, which contains the ADOX namespace; then reference C: ProgramFilesCommonFilesSystemadomsjro. dll, which contains the JRO namespace SxS
How to use c # To operate ACCESS databases: Microsoft Access is not available at hand, and how to create a database is stil
'First, perform the following test:'Create a blank access database (. mdb) file,'And add several types of chain tables:'Dbase 5 (*. DBF ),'Microsoft Excel (*. xls ),'Microsoft access (*. mdb; *. MDA; *. MDE,'Then write the following VB6: Program :'Delphi, VC and other programs can also be:'Reference Microsoft ActiveX Data Objects 2.x Library'Reference Microsoft ADO Ext. 2.x for DDL and security'Controls: form1, command1, command2, command3Private sub commandementclick () 'test the chain table in
from the Internet.
Who can tell me how to implement the latter two methods?
---------------------------------------------------------------
Here's the ADOX code I'm using, just to prove that access has this feature (it's not nice to say: This is about Access p?). This is the problem that the ADO model solves. And you also mention the wrong place, mention ASP that piece more appropriate, do access programming should understand, if you do not unders
access I mentioned has this function (which is not nice to say: this is about access P? This is the problem solved by the ADO model. In addition, you also mentioned the mistake, which is more suitable for ASP.) You should be familiar with access programming. If you cannot understand it, I can only say sorry.
Public Function newlinkedexternaltablemdb ()Dim strtargetdb () as stringDim strproviderstring () as stringDim strsourcetbl () as stringDim strlinktblname () as stringDim catdb as
There are two ways to create an access primary key: one is manually created in access, the other is created using code (whether in access or in external programs ).
Different primary key names are also different. The primary key names created in the first method are primarykey. Note that there is no space in the middle. The names of the second primary key must be identified using VBA code:
Public Sub fnGetPrimaryKeyName ()Dim v_DB As New ADOX. Catalog
To operate the ACCESS database, you need to add a field, but you do not know how to set the attribute of the field. I found some information and found the field attribute.
Then I found some information and used the most stupid way to add all the attributes of the field. Of course, I have never understood why Microsoft does not write these attributes, but uses a set.
First, create an Access database, create a table, and create a field. Set the attributes of the field.
Then read the database with
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.