Click here to Skip to main content
15,910,234 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Change Hdd Name from VB.net Pin
Dave Kreskowiak31-Jul-07 12:04
mveDave Kreskowiak31-Jul-07 12:04 
QuestionCreate an Update for my project.... Pin
CCG331-Jul-07 8:32
CCG331-Jul-07 8:32 
AnswerRe: Create an Update for my project.... Pin
Naji El Kotob31-Jul-07 9:06
Naji El Kotob31-Jul-07 9:06 
GeneralRe: Create an Update for my project.... [modified] Pin
CCG331-Jul-07 9:48
CCG331-Jul-07 9:48 
GeneralRe: Create an Update for my project.... Pin
CCG331-Jul-07 11:42
CCG331-Jul-07 11:42 
QuestionCreating database through vb.net Pin
Kashif Sabir31-Jul-07 7:19
Kashif Sabir31-Jul-07 7:19 
AnswerRe: Creating database through vb.net Pin
Dave Kreskowiak31-Jul-07 10:07
mveDave Kreskowiak31-Jul-07 10:07 
GeneralRe: Creating database through vb.net Pin
Kashif Sabir31-Aug-07 0:34
Kashif Sabir31-Aug-07 0:34 
Sorry for replying late

Following is the code for creating database please reply.
This is how i create the data base and table.


Public Function Create_UserDB(strDBFolder As String, strDBName As String, isDoubleAccounting As Boolean, isGLInclude As Boolean) As Boolean
Dim strQuery As String

Create_UserDB = False

strQuery = "CREATE DATABASE [" & strDBName & "] "
strQuery = strQuery & " ON (NAME = N'RWSDB_Data', FILENAME = N'" & strDBFolder & "\" & strDBName & ".mdf' "
strQuery = strQuery & " , SIZE = 3, FILEGROWTH = 10%) LOG "
strQuery = strQuery & " ON (NAME = N'RWSDB_Log', FILENAME = N'" & strDBFolder & "\" & strDBName & ".ldf' "
strQuery = strQuery & " , SIZE = 1, FILEGROWTH = 10%)"
ExecuteQuery strQuery

strQuery = "exec sp_dboption N'" & strDBName & "', N'autoclose', N'false'": ExecuteQuery strQuery
strQuery = "exec sp_dboption N'" & strDBName & "', N'bulkcopy', N'false'": ExecuteQuery strQuery
strQuery = "exec sp_dboption N'" & strDBName & "', N'trunc. log', N'true'": ExecuteQuery strQuery
strQuery = "exec sp_dboption N'" & strDBName & "', N'torn page detection', N'true'": ExecuteQuery strQuery
strQuery = "exec sp_dboption N'" & strDBName & "', N'read only', N'false'": ExecuteQuery strQuery
strQuery = "exec sp_dboption N'" & strDBName & "', N'dbo use', N'false'": ExecuteQuery strQuery
strQuery = "exec sp_dboption N'" & strDBName & "', N'single', N'false'": ExecuteQuery strQuery
strQuery = "exec sp_dboption N'" & strDBName & "', N'autoshrink', N'true'": ExecuteQuery strQuery
strQuery = "exec sp_dboption N'" & strDBName & "', N'ANSI null default', N'false'": ExecuteQuery strQuery
strQuery = "exec sp_dboption N'" & strDBName & "', N'recursive triggers', N'false'": ExecuteQuery strQuery
strQuery = "exec sp_dboption N'" & strDBName & "', N'ANSI nulls', N'false'": ExecuteQuery strQuery
strQuery = "exec sp_dboption N'" & strDBName & "', N'concat null yields null', N'false'": ExecuteQuery strQuery
strQuery = "exec sp_dboption N'" & strDBName & "', N'cursor close on commit', N'false'": ExecuteQuery strQuery
strQuery = "exec sp_dboption N'" & strDBName & "', N'default to local cursor', N'false'": ExecuteQuery strQuery
strQuery = "exec sp_dboption N'" & strDBName & "', N'quoted identifier', N'false'": ExecuteQuery strQuery
strQuery = "exec sp_dboption N'" & strDBName & "', N'ANSI warnings', N'false'": ExecuteQuery strQuery
strQuery = "exec sp_dboption N'" & strDBName & "', N'auto create statistics', N'true'": ExecuteQuery strQuery
strQuery = "exec sp_dboption N'" & strDBName & "', N'auto update statistics', N'true'": ExecuteQuery strQuery

strQuery = "CREATE TABLE [" & strDBName & "].[dbo].[Calendar] ("
strQuery = strQuery & " [Code] [nvarchar] (2) NOT NULL ,"
strQuery = strQuery & " [Original] [nvarchar] (4) NOT NULL ,"
strQuery = strQuery & " [Type] [nvarchar] (1) NOT NULL"
strQuery = strQuery & " ) ON [PRIMARY]"
ExecuteQuery strQuery

strQuery = "CREATE TABLE [" & strDBName & "].[dbo].[CompanyPersonalInformation] ("
strQuery = strQuery & " [Code] [nvarchar] (5) NOT NULL ,"
strQuery = strQuery & " [Ucode] [nvarchar] (5) NOT NULL ,"
strQuery = strQuery & " [GKey] [nvarchar] (100) NOT NULL ,"
strQuery = strQuery & " [CompanyName] [nvarchar] (100) NOT NULL ,"
strQuery = strQuery & " [Address] [nvarchar] (200) NOT NULL ,"
strQuery = strQuery & " [City] [nvarchar] (50) NOT NULL ,"
strQuery = strQuery & " [Country] [nvarchar] (50) NOT NULL ,"
strQuery = strQuery & " [Province] [nvarchar] (50) NOT NULL ,"
strQuery = strQuery & " [ZipCode] [nvarchar] (50) NOT NULL ,"
strQuery = strQuery & " [PhNo] [nvarchar] (50) NOT NULL ,"
strQuery = strQuery & " [FaxNo] [nvarchar] (50) NOT NULL ,"
strQuery = strQuery & " [EMail] [nvarchar] (50) NOT NULL ,"
strQuery = strQuery & " [WebAddrs] [nvarchar] (50) NOT NULL ,"
strQuery = strQuery & " [NTax] [nvarchar] (50) NOT NULL ,"
strQuery = strQuery & " [STax] [nvarchar] (50) NOT NULL ,"
strQuery = strQuery & " [FromDate] [nvarchar] (10) NOT NULL ,"
strQuery = strQuery & " [ToDate] [nvarchar] (10) NOT NULL ,"
strQuery = strQuery & " [CompanyName4Printing] [nvarchar] (100) NOT NULL ,"
strQuery = strQuery & " [STaxRate] [nvarchar] (50) NOT NULL ,"
strQuery = strQuery & " [IncomeTaxRate] [nvarchar] (50) NOT NULL ,"
strQuery = strQuery & " [MonthClosing] [nvarchar] (10) NOT NULL ,"
strQuery = strQuery & " [InstallationDate] [nvarchar] (10) NOT NULL ,"
strQuery = strQuery & " [ExpiryDate] [nvarchar] (10) NOT NULL ,"
strQuery = strQuery & " [Logo] [image] NOT NULL ,"
strQuery = strQuery & " [PictureSize] [numeric](18, 0) NOT NULL ,"
strQuery = strQuery & " [CreatedBy] [int] NOT NULL ,"
strQuery = strQuery & " [CreatedOn] [smalldatetime] NOT NULL ,"
strQuery = strQuery & " [UpdatedBy] [int] NOT NULL ,"
strQuery = strQuery & " [UpdatedOn] [smalldatetime]"
strQuery = strQuery & " ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]"
ExecuteQuery strQuery

Public Sub ExecuteQuery(Squery As String, Optional Action As String)
On Error GoTo errhandle


G_cn_ConnectionToMainDB.Execute Squery 'Connection to Master Database

Exit Sub
errhandle:
DisplayErrMsg (Err.Description)
' With frmStop
' .InitForm "Error Message", Err.Description, True
' .Show vbModal
' End With
End Sub



Kashif Sabir
AnswerRe: Creating database through vb.net Pin
Paul Conrad31-Jul-07 13:15
professionalPaul Conrad31-Jul-07 13:15 
QuestionCreating a help file Pin
dptalt31-Jul-07 6:47
dptalt31-Jul-07 6:47 
AnswerRe: Creating a help file Pin
Dave Kreskowiak31-Jul-07 7:52
mveDave Kreskowiak31-Jul-07 7:52 
GeneralRe: Creating a help file Pin
dptalt31-Jul-07 9:21
dptalt31-Jul-07 9:21 
GeneralRe: Creating a help file Pin
Dave Kreskowiak31-Jul-07 9:32
mveDave Kreskowiak31-Jul-07 9:32 
GeneralRe: Creating a help file Pin
dptalt31-Jul-07 10:45
dptalt31-Jul-07 10:45 
Questionis there any flex grid in vb.net Pin
SamRST31-Jul-07 4:21
SamRST31-Jul-07 4:21 
AnswerRe: is there any flex grid in vb.net Pin
nlarson1131-Jul-07 4:25
nlarson1131-Jul-07 4:25 
GeneralRe: is there any flex grid in vb.net Pin
SamRST31-Jul-07 4:28
SamRST31-Jul-07 4:28 
GeneralRe: is there any flex grid in vb.net Pin
SamRST31-Jul-07 4:28
SamRST31-Jul-07 4:28 
GeneralRe: is there any flex grid in vb.net Pin
nlarson1131-Jul-07 4:32
nlarson1131-Jul-07 4:32 
Questionhow to add all fonts in a combo Pin
eyes200731-Jul-07 4:21
eyes200731-Jul-07 4:21 
AnswerRe: how to add all fonts in a combo Pin
swapnil_zarbade31-Jul-07 5:34
swapnil_zarbade31-Jul-07 5:34 
GeneralRe: how to add all fonts in a combo Pin
eyes200731-Jul-07 5:51
eyes200731-Jul-07 5:51 
GeneralRe: how to add all fonts in a combo Pin
Luc Pattyn31-Jul-07 6:14
sitebuilderLuc Pattyn31-Jul-07 6:14 
GeneralRe: how to add all fonts in a combo Pin
Dave Kreskowiak31-Jul-07 6:59
mveDave Kreskowiak31-Jul-07 6:59 
GeneralRe: how to add all fonts in a combo Pin
The Man from U.N.C.L.E.31-Jul-07 8:05
The Man from U.N.C.L.E.31-Jul-07 8:05 

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.