Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
nounabarbie
Starting Member
10 Posts |
Posted - 2006-02-18 : 14:12:07
|
| HiI am using SQL server for the first time.I found SQL server books online hard to understand,so I want to ask 2 questions:First,how can I create a table,in fact I want to create a database containing 2 tables.Second,I have a visual basic form in which I enter data.Uponpressing the "send" button,I want to be able to send my data entries to an SQL server table.When I want to send data entries from Vb form to an access table, I use the following code:Dim rstablename As ADODB.RecordsetSet rstablename = New ADODB.Recordset rstablename.Open "tablename", cnnTest, adOpenStatic, adLockOptimistic, adCmdTable rstablename.AddNew rstablename![field1] = txtname1.text rstablename![field2] = txtname2.text ... rsArticle.Update rsArticle.CloseWhat's the difference if instead using an access database,I am using SQL server databaseCould you give me the detailed steps to do my 2 tasks?thanks in advance |
|
|
afrika
Master Smack Fu Yak Hacker
2706 Posts |
Posted - 2006-02-18 : 14:22:26
|
Access is a file database, which means its supports a few to hundreds of cuncurrent users, while MSSQL is an enterprise database management system, which can support thousands and millions of users. regarding your requests, i would advice you go for a training in databases and VB, for books see this linkhttp://www.sqlteam.com/store.aspThere are two ways to create a database and tables, either in Query analyzer or Enterprise manager. See books online or buy a bookAfrikaOh, by the way Welcome to SQLTeam |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2006-02-18 : 14:54:51
|
Here is some basic T-Sql code to show how to create a database, table, stored procedure, and execute the stored procedure. You can execute all this code in a Query Analyzer window. Definately keep with trying to get used to Books Online, it will be your best resource. As far as the application code to make calls to your database, I'd suggest first things first. Get the Sql side working. After that you can post some specific questions in the developer's forum or the Asp.net forum.use mastergoCreate Database myNewDatabasegouse myNewDatabasego-----------------------------------------------------------create a table (CREATE TABLE in Books Online)if object_id('myNewTable1') > 0 drop table myNewTable1gocreate table myNewTable1 (myNewTable1ID int identity(1,1) primary key ,i int not null ,createDate datetime not null ,updateDate datetime null)go------------------------------------------------------------create a storte procedure to insert data to myNewTable1 (CREATE PROCEDURE in Books Online)if object_id('myNewTable1_ins') > 0 drop procedure myNewTable1_insgocreate procedure mynewTable1_ins@i intasinsert myNewTable1 (i, createDate)values (@i, getdate())go----------------------------------------------------------exec myNewTable1_ins @i = 10exec myNewTable1_ins @i = -2select myNewTable1ID ,i ,createDate ,updateDatefrom myNewTable1gouse masterdrop database myNewDatabaseBe One with the OptimizerTG |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2006-02-19 : 03:34:17
|
| Have you got Enterprise Manager installed? (It comes with SQL Server 2000)If so open up your database, right click to create a new table, and then in the Table Designer type in the column names you want, choose the datatype (and size when appropriate)Its advisable to use the "door key" button to mark the Primary Key column(s) - they are the one(s) which will uniquely identify the record.If you have been using Access you should find that route pretty similar to Access.Kristen |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-02-20 : 00:44:09
|
| Also make use of Query Analyser to test your queriesMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|