Hi I am new to
vb.net and ASP.
I am running SQL2000 and Visual Studio.net on the same computer (I Don't know if this is a problem)
I am having problems fine tuning the SQL server. I am using MS SQL 2000 and have downloaded the MS SQL Server
Desktop Engine to run SQL server manager.I am having problems accessing the database fields from the SQL
server.I used the Import and Export data feature to export the MS Access db to the OLE Provider for SQL.
Question 1 : When I click the server listbox to select the servers , none appear. I type in (local) and a
list of databases appears in the Database listbox. Shouldn't the servers already be present in the server listbox
? Is this the reason why My progarmme is not running properly? Are servers active or not?????
Please review my code in conjunctiion with the SQL Server Querry .Also please advice me on setting the SQL
server Group in the SQL Server Enterprise Manager - Is this where you fine tune your SQL Server??
One more question what are ASMX files used for?
I would really appreciate any help on this topic
THANK YOU
Imports System
Imports System.Data
Imports System.Data.SqlClient
Public Class WebForm1
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim configurationAppSettings As System.Configuration.AppSettingsReader = New System.Configuration.AppSettingsReader
Me.cn = New System.Data.SqlClient.SqlConnection
Me.cd = New System.Data.SqlClient.SqlCommand
'
'cn
'
Me.cn.ConnectionString = CType(configurationAppSettings.GetValue("cn.Connec tionString", GetType(System.String)), String)
'
'cd
'
Me.cd.CommandText = "SELECT Aircraft.* FROM Aircraft WHERE ([Aircraft- id] = @AircraftID)"
Me.cd.Connection = Me.cn
Me.cd.Parameters.Add(New System.Data.SqlClient.SqlParameter("Parameter1", System.Data.SqlDbType.NVarChar))
End Sub
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents Label2 As System.Web.UI.WebControls.Label
Protected WithEvents Label3 As System.Web.UI.WebControls.Label
Protected WithEvents Label4 As System.Web.UI.WebControls.Label
Protected WithEvents bntFind As System.Web.UI.WebControls.Button
Protected WithEvents bntCreate As System.Web.UI.WebControls.Button
Protected WithEvents btnUpdate As System.Web.UI.WebControls.Button
Protected WithEvents btnDelete As System.Web.UI.WebControls.Button
Protected WithEvents btnBookings As System.Web.UI.WebControls.Button
Protected WithEvents txtID As System.Web.UI.WebControls.TextBox
Protected WithEvents txtSurname As System.Web.UI.WebControls.TextBox
Protected WithEvents txtForename As System.Web.UI.WebControls.TextBox
Protected WithEvents txtTitle As System.Web.UI.WebControls.TextBox
Protected WithEvents lblError As System.Web.UI.WebControls.Label
Protected WithEvents cn As System.Data.SqlClient.SqlConnection
Protected WithEvents cd As System.Data.SqlClient.SqlCommand
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub bntFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntFind.Click
Dim AircraftID As String = txtID.Text
Dim dr As SqlDataReader
Dim cn As New SqlConnection
Dim cd As New SqlCommand
Try
cn.ConnectionString = "Data Source=local"
cd.Connection = cn
cd.CommandText = "select Aircraft-id, Registration ,Manufacture,Model from Aircraft where Aircraft-id = " + AircraftID
cn.Open()
dr = cd.ExecuteReader
dr.Read()
txtID.Text = dr("Aircraft-id").ToString
txtTitle.Text = dr("Registration").ToString
txtForename.Text = dr("Manufacture").ToString
txtSurname.Text = dr("Model").ToString
Catch
lblError.Text = "Unable to find details for aircraft" + " " + AircraftID
Finally
If Not dr Is Nothing Then dr.Close()
cn.Close()
End Try
End Sub
Private Sub cn_InfoMessage(ByVal sender As System.Object, ByVal e As System.Data.SqlClient.SqlInfoMessageEventArgs)
End Sub
End Class