Using SQL Server 2005 Express.
I want to create and maintain the SQL database and tables from within a VB6 application. First I need to create an empty database file. This I can't do.
Using
Set mcn = New ADODB.Connectio n
mcn.Open mstrConnectStri ng
I have tried various connection strings -
mstrConnectStri ng="server=(loc al)\SQLEXPRESS; " & "integrated security=sspi;d atabase=;"
mstrConnectStri ng="Data Source=.\SQLEXP RESS;AttachDbFi lename=" & "xxx.mdf" & ";Integrate d Security=True;C onnect Timeout=30;User Instance=True"
4 9228
Connection string is used to used to connect to an existing database not to create a new one.
First, you need to have Administrative Rights to the database engine ("SA"). This includes read, write, create, delete. Then, you do not connect to any particular database but if you must connect to a database then connect to the MASTER database. Then you will need to execute a CREATE DATABASE statement, followed by CREATE TABLE statements... http://msdn.microsoft.com/en-us/library/ms176061.aspx
Use the pane on the left to navigate to the CREATE TABLE statement, and you may want to look at the CREATE INDEX and CREATE PROCEDURE if you are wanting to create stored procedures.
So, you process would go like this...
Connect to MASTER
CREATE DATABASE
USE DATABASE_NAME 'to switch to the database you just created
CREATE TABLE
CREATE INDEX
CREATE PROCEDURE
then if you are wanting to insert data into the database, use the INSERT STATEMENT or if you have created a stored procedure us it...
Good Luck
My problem is to get connected so I can create my SS db from the VB6 application.
The answer I needed was how to connect so I could run the SQL create DB.
Your answer is Database=Master ;
The rest is -
ConnectionStrin g = "Provider=SQLNC LI;Server=YourS erverName;Datab ase=Master;Inte grated Security=SSPI;"
Many thanks
Yes, just be careful to not make any changes to the MASTER database because if you do, you could ruin the entire installation or DBMS...
Good Luck
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Jonas L |
last post by:
I'm creating a application that should handle contacts, orders etc.
I want to distribute only the exe file and let the application take
care of creating and changing the database that is to be used.
Furthermore, I would also like to make it possible for the user to
select which sort of database to create and use, MSSQL, Oracel, Access
etc.
Is this possible? Or do I have distribute a databas file as well? My
first idea was to use OLEDB...
|
by: NWx |
last post by:
Hi,
I write an ASP,NET application who uses SQL Server (MSDE) as Back-end
I'm an experienced developer, but haven't used SQL server before and I need
some help.
Since I don't have full SQL server (but only MSDE), I don't have Enterprise
manager.
So I used Access XP (using an ADP file) to create the database on MSDE
server (tables, views, stored procs etc)
|
by: AlexDP |
last post by:
My program has to access an SQL Server DB file that is in the same folder as
the executable. i dont want to setup a server. i was able to do this on my
own computer, the program would access any sql server db file without it
being attached to the server. When i take it to another system it fails to
run.
All systems have SQL Server Express and SQL Server 2005 installed.
Can someone please direct me through the steps to fix this problem?
...
|
by: orenbt78 |
last post by:
Hi,
I am trying to:
1. Create a SQL database (I am working with SQL 2005 Express)
2. with a C# code
3. when the user is not the computer administrator.
I have managed to create the database file (code below). I am not sure
it is the right way.
Can you take a look please?
|
by: Mrozik |
last post by:
Hi!
I have Web Application with forms authentication. Data
and security model resides in Oracle database.
I have 'login' page with MS 'Login' control.
In my LoggingIn event for debug purposes I have
only:
FormsAuthentication.RedirectFromLoginPage(
"testlogin', false);
(all users are authenticated)
It works fine till now - I have still error:
| |
by: Savante |
last post by:
I am trying to investigate the JET databases to enable me to save data
from a datalogging program I'm writing.
At the moment, I've been using tutorial 21 of the SAMS "Learn it in 24
hours book". Whilst the book has been useful in terms of adding and
editing records from an already existing database file, I want to be
able to make my own database file at runtime.
My databasing program can create an unknown number of columns and I...
|
by: AAaron123 |
last post by:
I want to create a database with one table on the host.
I can't user SQL Server Management Studio to do it so I guess I have to do
it programmatically.
I have in mind that in the session start (or maybe application start would
be better) I'd check to see it the database exists and if not create it.
The problem is that I have no idea how to do that.
|
by: KishorDhembare |
last post by:
Hi Everybady
I Want To Create New Database When My Application Starts First Time My Application Developed In Vb.net
I Get The Error When I Run Command which I Have Command Is Like.
Dim file As FileInfo = New FileInfo(Path.GetFullPath("TextFile1.txt"))
Dim backupScript As String = file.OpenText.ReadToEnd()
Dim strCommand As String = backupScript
|
by: santhanalakshmi |
last post by:
Hi,
I am trying to open database file(.mdf) using enterprise manager.
Right Click on Databases -> All Tasks -> Attach database
I am browsing the .mdf file from my local drive and finally clicking OK
It shows me an error. Please help me out.Thanks in advance. I cant able to find out
|
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,...
|
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...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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();...
|
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...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |