473,662 Members | 2,551 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

I can't create MDB File with ADO.net

thank
Nov 20 '05 #1
3 4981

"Research-13" <te*****@soluti ons-corp.co.th> wrote in message
news:MP******** *************** *@news.microsof t.com...
thank


Solution taken for www.tek-tips.com FAQ

Neither ADO.NET nor ActiveX Data Object (ADO) provides the means to
create Microsoft Access Database. However, we can create Access
databases by using the Microsoft Jet OLE DB Provider and Microsoft ADO
Ext. 2.7 for DDL and Security (ADOX) with the COM Interop layer.

1. Open a new Visual Basic .NET Windows application.
2. In Solution Explorer, right click the References node, and then
click Add References.
3. In the Add References dialog box, click COM tab, click Microsoft
ADO Ext. 2.7 for DDL and Security, click Select to add it to the
Selected Components section, and then click OK.
4. Make sure to add reference to ADOX class library namespace
(Imports ADOX).
5. Change the path to the new .mdb file as appropriate.
6. Make sure the folder provided in the path exists. If path name
is not specified, the database will be created in your application
folder.
7. Create a Button control named btnCreateDataba se on the form and
copy the following code in the click event of the button:

Imports ADOX

Private Sub onCreateDatabas eClick(ByVal sender As System.Object, ByVal
e As System.EventArg s) Handles btnCreateDataba se.Click
Dim cat As New Catalog()

Try
'Create NewDB Database.
'Change the path to the new .mdb file as appropriate. Make
sure the folder
'provided in the path exists. If you path name is not
specified, the
'database will be created in your application folder.
cat.Create("Pro vider=Microsoft .Jet.OLEDB.4.0; " & _
"Data Source=C:\NewDB .mdb")

MessageBox.Show ("Database Created.", "Message",
MessageBoxButto ns.OK, MessageBoxIcon. Information)

Catch Excep As System.Runtime. InteropServices .COMException
MessageBox.Show (Excep.Message, "Error",
MessageBoxButto ns.OK, MessageBoxIcon. Error)

Finally
cat = Nothing
End Try
End Sub
Nov 20 '05 #2
Cor
Hi,

Why not, I did send a sample to your previous message

Did you try it?

Cor

Nov 20 '05 #3
* Research-13 <te*****@soluti ons-corp.co.th> scripsit:
[...]

ADO.NET group:

<news://msnews.microsof t.com/microsoft.publi c.dotnet.framew ork.adonet>

Web interface:

<http://msdn.microsoft. com/newsgroups/default.asp?url =/newsgroups/loadframes.asp? icp=msdn&slcid= us&newsgroup=mi crosoft.public. dotnet.framewor k.adonet>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
9094
by: Dino | last post by:
dear all, i've created an application for a customer where the customer can upload ..csv-files into a specified ftp-directory. on the server, a php-script, triggered by a cronjob, reads all the data, imports it into a mySQL database and deletes the .csv-file after the import. so far, so good. but in some cases the cronjobs starts running when the file is not completely
3
6116
by: *no spam* | last post by:
I want to move my Access 2K database into MSDE. The Access Upsizing Wizard crashes (a known bug wi A2K), so I'm using the following suggested method: Access --> New --> Project (Existing Database) This asks for the name of the .adp file to create and then launches into the Data Link Properties dialog box (so far so good) I select my MSDE server from the drop-down, enter the sa account & passwd, attach a database file and try to...
2
13402
by: brazilnut52 | last post by:
I am going to outline the steps I go through to produce the problem. Hopefully this will help you understand the problem better I have created a simple COM DLL in .NET by using the COM class template and by setting output to a type library (DLL). All the object does is return a string value. At this point I have not checked the option to register for COM interop in Visual Studio So I go into Excel (where I want to use the object). Go to VB...
3
9824
by: Sushil Srivastava | last post by:
Hi Guys, Would you be able to help me using C# GUI (with user interface component) in my MFC application. I have used managed extension, COM-interops, etc but problem is this C# component has user interface. how should have get window handle from managed windows? Thanks in advance. Sushil
9
2298
by: Marc Miller | last post by:
Hi all, I have 2 dev. machines, the 1st is Win 2000 with .NET 7.0 and the 2nd is XP Pro with .NET 2003. My Web Server is Win 2000 Server with IIS 5.0. I can create a new project on my test server from the 1st machine, but I receive an 'HTTP/1.1 500 Internal Server error" from my Web Server. My userid/password are the same on all 3 machines.
2
1470
by: news.microsoft.com | last post by:
Hi all, I'm trying to find a way to set a value for a method or property of my class which will show up as summary when you look at the method/property in the Object browser. I know that in VB6 this was done by setting the procedure attributes but I can't find anything in .NET Does anybody know if it's possible... and if so how? TIA,
18
4335
by: Jen | last post by:
I'm using Microsoft's own VB.NET FTP Example: http://support.microsoft.com/default.aspx?scid=kb;en-us;832679 I can get the program to create directories, change directories, etc., but I can't get it to upload a file to the FTP server. I just get a "Cannot connect to remote server" error after this TRY: s = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
2
2749
by: dasilva109 | last post by:
Hi guys I am new to C++ and need urgent help with this part of my code for a uni coursework I have to submit by Thursday //ClientData.h #ifndef CLIENTDATA_H #define CLIENTDATA_H #include <string>
4
16661
by: nano2k | last post by:
Hi For some purposes, I need to create a new binary file and to allocate a fixed length for that file on the disk. I need something like File.Create(string fileName, long initialSizeInBytes). Is there a framework/system method to do that or should I create the file and then fill it until the size is reached? Thanks
14
1875
by: Joe | last post by:
this file is drawn in VB.NET and input output goes by XmlSerializer. Therefore, simple output file looks like: <?xml version="1.0" encoding="utf-8"?> <DrawablePicture xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" BackColor="-1250856"> <DrawableRectangle LineWidth="2" X1="377" Y1="88" X2="323" Y2="130" ForeColor="-16777216" BackColor="-1" /> </DrawablePicture>
0
8432
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8344
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8857
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8764
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5654
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4180
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.