Is there a way to create a brand new database on the server?
Someone gave me the asp code below, but I haven't gotten it to work yet.
Thanks for any help.
<%
Dim strSQL
Dim cnnTest
strSQL = strSQL & "CREATE TABLE tblTest " & vbCrLf
strSQL = strSQL & "(" & vbCrLf
strSQL = strSQL & "ID int IDENTITY NOT NULL " & vbCrLf
strSQL = strSQL & " constraint PK_tblTestID PRIMARY KEY, " & vbCrLf
strSQL = strSQL & "FirstName varchar (30) NOT NULL, " & vbCrLf
strSQL = strSQL & "LastName varchar (30) NOT NULL, " & vbCrLf
strSQL = strSQL & "DateOfBirth datetime NULL" & vbCrLf
strSQL = strSQL & ")" & vbCrLf
Set cnnTest = Server.CreateObject("ADODB.Connection")
response.write "got to here"
cnnTest.Open "Provider=SQLOLEDB;Data Source=localhost;" _
& "Initial Catalog=test;User Id=sa;Password=;" _
& "Connect Timeout=15;Network Library=dbmssocn;"
response.write "are we heare"
cnnTest.Execute strSQL
cnnTest.Close
Set cnnTest = Nothing
%> 2 1148
that creates a Table, not a new DB....which is it you are after? Also, why
are you posting it to these groups? some .Net, some not, some SQL.... ??
--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Scott Baxter" <sb*****@websearchstore.com> wrote in message
news:uk**************@TK2MSFTNGP09.phx.gbl... Is there a way to create a brand new database on the server?
Someone gave me the asp code below, but I haven't gotten it to work yet.
Thanks for any help.
<% Dim strSQL Dim cnnTest
strSQL = strSQL & "CREATE TABLE tblTest " & vbCrLf strSQL = strSQL & "(" & vbCrLf strSQL = strSQL & "ID int IDENTITY NOT NULL " & vbCrLf strSQL = strSQL & " constraint PK_tblTestID PRIMARY KEY, " & vbCrLf strSQL = strSQL & "FirstName varchar (30) NOT NULL, " & vbCrLf strSQL = strSQL & "LastName varchar (30) NOT NULL, " & vbCrLf strSQL = strSQL & "DateOfBirth datetime NULL" & vbCrLf strSQL = strSQL & ")" & vbCrLf
Set cnnTest = Server.CreateObject("ADODB.Connection") response.write "got to here" cnnTest.Open "Provider=SQLOLEDB;Data Source=localhost;" _ & "Initial Catalog=test;User Id=sa;Password=;" _ & "Connect Timeout=15;Network Library=dbmssocn;" response.write "are we heare" cnnTest.Execute strSQL cnnTest.Close Set cnnTest = Nothing %>
Hello,
Thanks for your help. I just wanted to create the actual database on the
server, then create a table within the database. I realize the sample code
I sent is probably not the right code.
I posted to several groups I thought seemed related to this question. Maybe
I picked the wrong ones.
Thanks.
Scott Baxter
"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:Oa*************@TK2MSFTNGP10.phx.gbl... that creates a Table, not a new DB....which is it you are after? Also, why are you posting it to these groups? some .Net, some not, some SQL.... ??
-- Curt Christianson Owner/Lead Developer, DF-Software Site: http://www.Darkfalz.com Blog: http://blog.Darkfalz.com
"Scott Baxter" <sb*****@websearchstore.com> wrote in message news:uk**************@TK2MSFTNGP09.phx.gbl... Is there a way to create a brand new database on the server?
Someone gave me the asp code below, but I haven't gotten it to work yet.
Thanks for any help.
<% Dim strSQL Dim cnnTest
strSQL = strSQL & "CREATE TABLE tblTest " & vbCrLf strSQL = strSQL & "(" & vbCrLf strSQL = strSQL & "ID int IDENTITY NOT NULL " & vbCrLf strSQL = strSQL & " constraint PK_tblTestID PRIMARY KEY, " & vbCrLf strSQL = strSQL & "FirstName varchar (30) NOT NULL, " & vbCrLf strSQL = strSQL & "LastName varchar (30) NOT NULL, " & vbCrLf strSQL = strSQL & "DateOfBirth datetime NULL" & vbCrLf strSQL = strSQL & ")" & vbCrLf
Set cnnTest = Server.CreateObject("ADODB.Connection") response.write "got to here" cnnTest.Open "Provider=SQLOLEDB;Data Source=localhost;" _ & "Initial Catalog=test;User Id=sa;Password=;" _ & "Connect Timeout=15;Network Library=dbmssocn;" response.write "are we heare" cnnTest.Execute strSQL cnnTest.Close Set cnnTest = Nothing %>
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Dim St Thomas |
last post by:
I am a developer working on a database client program. I am testing this
program on a Windows XP machine (1.5 GHz AMD chip, 480 Mb RAM, 60 Gb disk)
This machine has Oracle 9.2.0.1.0 and RedBrick...
|
by: Robin Tucker |
last post by:
Hi there,
I have a database on my test machine that will need to be installed on users
machines. I would like to create the database with the given schema on the
users machine and also with...
|
by: Bob Gabor |
last post by:
Running 8.1 w/FP5 on Windows 2000. Everytime I try to create a stored
procedure, I get the following error saying that my database is
damaged:
DB21034E The command was processed as an SQL...
|
by: Kiran |
last post by:
Hi,
I want to back up my data in some table in SQL server and import it back
using Bulk Load of SQL server 2K.
I can use the following code to backup the data in XML
...
|
by: Jerry Spence1 |
last post by:
Why doesn't the following work in my ASP program? I have imported ADOX
I am trying to create a temporary database on the user's PC. The example is
taken from Microsoft.
Dim cat As Catalog =...
|
by: Barry |
last post by:
Hi
can anyone tell me if there if any code snippet available for creating a
SQL Server Database and Table using C# web application.
TIA
Barry
|
by: C# Beginner |
last post by:
Hi there,
I'm currently trying to create a MS access file at runtime, but I stumble
into some problems.
1. When I use Datatype adUnsignedInt I get an error (invalid type).
2. Which datatype...
|
by: Motoma |
last post by:
This article is cross posted from my personal blog. You can find the original article, in all its splendor, at http://motomastyle.com/creating-a-mysql-data-abstraction-layer-in-php/.
Introduction:...
|
by: astolpho |
last post by:
I am using a slightly outdated reference book on J2EE programming. It gives 2 methods of creating a database used in its casestudies. The first is an ANT script that gives the following output:
...
|
by: DarkGiank |
last post by:
Hi, im new to csharp and im trying to create a class that can change the application database without no rewriting all connection code... but cause some reason it is not working... it tells me that...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
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...
|
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...
|
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...
|
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...
|
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,...
| |