Click here to Skip to main content
15,900,461 members
Home / Discussions / Database
   

Database

 
AnswerRe: how can i index the column ?? Pin
Colin Angus Mackay31-May-06 23:38
Colin Angus Mackay31-May-06 23:38 
Questionattach a database with code Pin
Mohammed Amine31-May-06 12:55
Mohammed Amine31-May-06 12:55 
AnswerRe: attach a database with code [modified] Pin
albCode31-May-06 23:32
albCode31-May-06 23:32 
AnswerRe: attach a database with code Pin
Eric Dahlvang1-Jun-06 2:56
Eric Dahlvang1-Jun-06 2:56 
GeneralRe: attach a database with code Pin
Mohammed Amine1-Jun-06 5:39
Mohammed Amine1-Jun-06 5:39 
GeneralRe: attach a database with code Pin
Eric Dahlvang1-Jun-06 7:07
Eric Dahlvang1-Jun-06 7:07 
GeneralRe: attach a database with code Pin
Mohammed Amine1-Jun-06 7:23
Mohammed Amine1-Jun-06 7:23 
AnswerRe: attach a database with code [modified] Pin
Eric Dahlvang1-Jun-06 7:55
Eric Dahlvang1-Jun-06 7:55 
sp_attach_db is a system stored procedure that is in the SQL Server master database.
If you really don't want to use it, you can use what is below (which is all the sp_attach_db does).

Also, I put this in vb.net - the last thing I posted was C#.
Imports System.Data
Imports System.Data.SqlClient

Dim conn As New SqlConnection
Dim myCommand As SqlCommand

conn.ConnectionString = "Data Source=(local);Initial Catalog=master;Integrated Security=SSPI"
conn.Open()

myCommand = conn.CreateCommand()
myCommand.CommandText = "CREATE DATABASE [ATestDB] ON (FILENAME = 'C:\TestPath\ATestDB_Data.MDF'), (FILENAME = 'C:\TestPath\ATestDB_Log.LDF') FOR ATTACH"

myCommand.ExecuteScalar()


Just change the name of ATestDB to whatever yours is, and the paths and filenames too.


----------
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them.
- Laurence J. Peters


-- modified at 13:55 Thursday 1st June, 2006
GeneralRe: attach a database with code [modified] Pin
Mohammed Amine1-Jun-06 10:28
Mohammed Amine1-Jun-06 10:28 
AnswerRe: attach a database with code [modified] Pin
Eric Dahlvang1-Jun-06 11:13
Eric Dahlvang1-Jun-06 11:13 
QuestionCode/Decode Password Pin
MohamadJaber31-May-06 10:40
MohamadJaber31-May-06 10:40 
AnswerRe: Code/Decode Password Pin
r.stropek4-Jun-06 6:22
r.stropek4-Jun-06 6:22 
QuestionReporting Services with ODP.Net Pin
RoadieGS31-May-06 8:57
RoadieGS31-May-06 8:57 
QuestionADO - SELECT statment Pin
antonaras31-May-06 0:25
antonaras31-May-06 0:25 
AnswerRe: ADO - SELECT statment Pin
sathish s31-May-06 2:08
sathish s31-May-06 2:08 
AnswerRe: ADO - SELECT statment Pin
sathish s31-May-06 2:11
sathish s31-May-06 2:11 
QuestionBinding Radio Button to datasource Pin
mamathy30-May-06 19:45
mamathy30-May-06 19:45 
AnswerRe: Binding Radio Button to datasource Pin
Paddy Boyd31-May-06 0:18
Paddy Boyd31-May-06 0:18 
AnswerRe: Binding Radio Button to datasource Pin
postmaster@programmingknowledge.com1-Jun-06 11:00
postmaster@programmingknowledge.com1-Jun-06 11:00 
QuestionBlob in 60 seconds [modified] Pin
BeerFizz30-May-06 15:34
BeerFizz30-May-06 15:34 
AnswerRe: Blob in 60 seconds [modified] Pin
BeerFizz31-May-06 1:54
BeerFizz31-May-06 1:54 
AnswerRe: Blob in 60 seconds [modified] Pin
Eric Dahlvang31-May-06 3:19
Eric Dahlvang31-May-06 3:19 
GeneralRe: Blob in 60 seconds [modified] Pin
BeerFizz31-May-06 3:46
BeerFizz31-May-06 3:46 
GeneralRe: Blob in 60 seconds [modified] Pin
Eric Dahlvang31-May-06 5:08
Eric Dahlvang31-May-06 5:08 
GeneralRe: Blob in 60 seconds [modified] Pin
BeerFizz31-May-06 5:30
BeerFizz31-May-06 5:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.