Click here to Skip to main content
15,887,350 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Cancel...Cancel...Cancel...Problem. Pin
kubben2-Mar-07 3:12
kubben2-Mar-07 3:12 
GeneralRe: Cancel...Cancel...Cancel...Problem. Pin
NANCO3-Mar-07 0:52
NANCO3-Mar-07 0:52 
Questionlistview selected item text Pin
FeRtoll1-Mar-07 23:42
FeRtoll1-Mar-07 23:42 
AnswerRe: listview selected item text Pin
JUNEYT2-Mar-07 1:42
JUNEYT2-Mar-07 1:42 
Questionhow to create Pin
taherjaorawala1-Mar-07 23:30
taherjaorawala1-Mar-07 23:30 
AnswerRe: how to create Pin
Colin Angus Mackay1-Mar-07 23:52
Colin Angus Mackay1-Mar-07 23:52 
GeneralRe: how to create Pin
taherjaorawala2-Mar-07 19:31
taherjaorawala2-Mar-07 19:31 
AnswerRe: how to create Pin
theScorp2-Mar-07 20:09
theScorp2-Mar-07 20:09 
Well try using "SQLDMO" dll
This code worked for SQL 2000.
Some code -

Imports System.Data.SqlClient
Imports SQLDMO


'Lists available servers
Private oSqlServer As New SQLDMO.SQLServer
Dim sqlDmoApplication As New SQLDMO.Application
Dim serverList As SQLDMO.NameList
serverList = sqlDmoApplication.ListAvailableSQLServers()


'Create Database
Private Function createDB() As Boolean
Dim oDatabase As SQLDMO.Database
Dim oDBFileData As SQLDMO.DBFile
Dim oLogFile As SQLDMO.LogFile
oDatabase = New Database
oDBFileData = New DBFile
oLogFile = New LogFile

Try

'Delete Database if it exists
Call connectDB()
'If Not IsNothing(oSqlServer.Databases.Item(txtDBName.Text.Trim())) Then
'oSqlServer.Databases.Item(DBToCreate).Remove()

'Response.Write("Database with same name already exists")
'End If
For i As Integer = 1 To oSqlServer.Databases.Count
If txtDBName.Text.Trim().ToUpper = oSqlServer.Databases.Item(i).Name.Trim.ToUpper() Then
lblAlert.Text = ("Database with same name already exists, please mention different name")
Return False
End If
Next
oDatabase.Name = txtDBName.Text.Trim() '"SOM_DB"

' Define the PRIMARY data file.
oDBFileData.Name = txtDBName.Text.Trim() & "Data"
' Replace the following path with your own path to a database folder.
oDBFileData.PhysicalName = "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\" & txtDBName.Text.Trim() & "_DB.mdf"
oDBFileData.PrimaryFile = True

' Specify file growth in chunks of fixed size for all data files.
oDBFileData.FileGrowthType = SQLDMO.SQLDMO_GROWTH_TYPE.SQLDMOGrowth_MB
oDBFileData.FileGrowth = 1

oDatabase.FileGroups.Item("PRIMARY").DBFiles.Add(oDBFileData)

' Define the database transaction log.
oLogFile.Name = txtDBName.Text.Trim() & "Log1"
' Replace the following path with your own path to a database folder.
oLogFile.PhysicalName = "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\" & txtDBName.Text.Trim() & "_DB.ldf"
oDatabase.TransactionLog.LogFiles.Add(oLogFile)

oSqlServer.Databases.Add(oDatabase)

oDatabase = Nothing
oDBFileData = Nothing
oLogFile = Nothing

Return True
Catch ex As Exception
lblAlert.Text = "Error : " & ex.Message()
Return False
End Try

End Function


"If our Mind can, the Program can !!"
Questiondiff values with n without debug statement Pin
khanmubashir1-Mar-07 23:17
khanmubashir1-Mar-07 23:17 
AnswerRe: diff values with n without debug statement Pin
JUNEYT2-Mar-07 1:50
JUNEYT2-Mar-07 1:50 
GeneralRe: diff values with n without debug statement Pin
khanmubashir2-Mar-07 5:07
khanmubashir2-Mar-07 5:07 
QuestionCustom Bar chart - Guidance needed Pin
sameerkm1-Mar-07 22:55
sameerkm1-Mar-07 22:55 
QuestionEstablishing a connection through a firewall (Proxy Server) Pin
MatthysDT1-Mar-07 22:45
MatthysDT1-Mar-07 22:45 
AnswerRe: Establishing a connection through a firewall (Proxy Server) Pin
Dave Kreskowiak2-Mar-07 4:39
mveDave Kreskowiak2-Mar-07 4:39 
GeneralRe: Establishing a connection through a firewall (Proxy Server) Pin
MatthysDT4-Mar-07 20:45
MatthysDT4-Mar-07 20:45 
QuestionMSHFLEXGRID Pin
Priya_20071-Mar-07 20:17
Priya_20071-Mar-07 20:17 
AnswerRe: MSHFLEXGRID Pin
Dave Kreskowiak2-Mar-07 4:36
mveDave Kreskowiak2-Mar-07 4:36 
QuestionApplication path in VB.Net Pin
Priya_20071-Mar-07 20:08
Priya_20071-Mar-07 20:08 
AnswerRe: Application path in VB.Net Pin
Colin Angus Mackay1-Mar-07 22:38
Colin Angus Mackay1-Mar-07 22:38 
AnswerRe: Application path in VB.Net Pin
Dave Kreskowiak2-Mar-07 4:17
mveDave Kreskowiak2-Mar-07 4:17 
QuestionHow to create a frames in vb.net? Pin
jeyanvidu1-Mar-07 18:53
jeyanvidu1-Mar-07 18:53 
AnswerRe: How to create a frames in vb.net? Pin
JUNEYT2-Mar-07 1:52
JUNEYT2-Mar-07 1:52 
QuestionHow do I fill a color fo range of selcted cell? Pin
B.L.Praveen1-Mar-07 18:31
B.L.Praveen1-Mar-07 18:31 
AnswerRe: How do I fill a color fo range of selcted cell? Pin
JUNEYT4-Mar-07 4:59
JUNEYT4-Mar-07 4:59 
Questiontyped datset, refilling problem Pin
steve_rm1-Mar-07 14:52
steve_rm1-Mar-07 14:52 

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.