im using : v.s 2003
sql server: 2000
im creating this vb application and i took a coding from the inter net which uses 2005 i only have one error that is it's not supported in v.s 2003 can some one help me how to solve this
my problem occurs in here and giving me the error " Name 'My' is not declared. "
masterConnection.ConnectionString = My.Settings.masterConnectionString
below is the hole code
Imports System.ComponentModel
Imports System.Configuration.Install
Imports System.IO
Imports System.Reflection
Imports System.Data.SqlClient
Imports System.Data
'<RunInstaller(True)> Public Class VbDeployInstaller
'Inherits System.Configuration.Install.Installer
'#Region " Component Designer generated code "
'Public Sub New()
' MyBase.New()
'This call is required by the Component Designer.
' InitializeComponent()
'Add any initialization after the InitializeComponent() call
' End Sub
<RunInstaller(True)> Public Class VbDeployInstaller
Inherits System.Configuration.Install.Installer
'#Region " Component Designer generated code "
'Public Class VbDeployInstaller
Dim masterConnection As New System.Data.SqlClient.SqlConnection
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
'Add initialization code after the call to InitializeComponent
End Sub
Private Function GetSql(ByVal Name As String) As String
Try
' Gets the current assembly.
Dim Asm As [Assembly] = [Assembly].GetExecutingAssembly()
' Resources are named using a fully qualified name.
Dim strm As Stream = Asm.GetManifestResourceStream( _
Asm.GetName().Name + "." + Name)
' Reads the contents of the embedded file.
Dim reader As StreamReader = New StreamReader(strm)
Return reader.ReadToEnd()
Catch ex As Exception
MsgBox("In GetSQL: " & ex.Message)
Throw ex
End Try
End Function
Private Sub ExecuteSql(ByVal DatabaseName As String, ByVal Sql As String)
Dim Command As New SqlClient.SqlCommand(Sql, masterConnection)
'Initialize the connection, open it, and set it to the "master" database
masterConnection.ConnectionString = My.Settings.masterConnectionString
Command.Connection.Open()
Command.Connection.ChangeDatabase(DatabaseName)
Try
Command.ExecuteNonQuery()
Finally
' Closing the connection should be done in a Finally block
Command.Connection.Close()
End Try
End Sub
Protected Sub AddDBTable(ByVal strDBName As String)
Try
' Creates the database.
ExecuteSql("MerryMeeting", "CREATE DATABASE " + strDBName)
' Creates the tables.
ExecuteSql(strDBName, GetSql("sql.txt"))
Catch ex As Exception
' Reports any errors and abort.
MsgBox("In exception handler: " & ex.Message)
Throw ex
End Try
End Sub
Public Overrides Sub Install(ByVal stateSaver As _
System.Collections.IDictionary)
MyBase.Install(stateSaver)
AddDBTable(Me.Context.Parameters.Item("dbname"))
End Sub
'Installer overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
'#End Region
End Class