Click here to Skip to main content
15,891,607 members
Home / Discussions / Database
   

Database

 
GeneralRe: XML Database Pin
surfman1920-Aug-05 12:41
surfman1920-Aug-05 12:41 
GeneralRe: XML Database Pin
Colin Angus Mackay20-Aug-05 23:03
Colin Angus Mackay20-Aug-05 23:03 
GeneralRe: XML Database Pin
Frank Kerrigan23-Aug-05 0:15
Frank Kerrigan23-Aug-05 0:15 
QuestionNewbie: ODBC or OleDb SQL Command Dictionary? Pin
zPaul19-Aug-05 9:49
zPaul19-Aug-05 9:49 
GeneralDataGrid bounded to a DataTable with composite key Pin
miah alom19-Aug-05 7:33
miah alom19-Aug-05 7:33 
Generaldropdownlist in datagrid Pin
sarah_chandran19-Aug-05 1:01
sarah_chandran19-Aug-05 1:01 
GeneralRe: dropdownlist in datagrid Pin
miah alom19-Aug-05 6:24
miah alom19-Aug-05 6:24 
GeneralHELP unable to connect to sql server Pin
christy1818-Aug-05 23:56
christy1818-Aug-05 23:56 
i'm just learning asp.net, n it's really frustrating as i can't seem to be able to connect to it..

this is a simple code i wrote to insert records into a table called 'Cars" AND A DATABASE Called "MotorSolutions..
here is my code:
<%@ Page Language="vb" debug="true" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Data" %>




Sub Page_Load(Source As Object, E as EventArgs)
If Page.IsPostBack Then
lblTitle.Text = "Submit was successful"
Else
lblTitle.Text = "Leave the field blank and Submit"

End If
End Sub

Sub btn_click(Src As Object, E As EventArgs)
Dim DBConn as New SqlConnection
Dim DBAdd as New SqlCommand
DBConn = New SqlConnection("server=localhost;database=MotorSolutions;Uid=sa;pwd=5864jc;")

DBAdd.CommandText = "INSERT Into Cars(" _
& "Manufacturer, " _
& "Model) values (" _
& "'" & Replace(txtMF.Text, "'", "''") _
& "', " _
& "'" & Replace(txtModel.Text, "'", "''") _
& "')"
DBAdd.Connection = DBConn
DBAdd.Connection.Open
DBAdd.ExecuteNonQuery()

End Sub









<asp:label id="lblTitle" runat="SERVER">



Manufacturer:
  <asp:textbox id="txtMF" runat="server"> * <asp:requiredfieldvalidator
id="rfvManufacturer"
="" errormessage="Please enter the car manufacturer" runat="server" controltovalidate="txtMF" backcolor="#FFFF80" display="Dynamic">
 
Model :
  <asp:textbox id="txtModel" runat="server">
*
<asp:requiredfieldvalidator
id="rfvModel"
="" errormessage="Please enter the car model" runat="server" controltovalidate="txtModel" backcolor="#FFFF80" display="Dynamic">
 


<asp:button id="btnSubmit" runat="SERVER" text="Submit" onclick="btn_click">








please can somebody help me...i keep getting this error:

Server Error in '/' Application.
SQL Server does not exist or access denied.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: SQL Server does not exist or access denied.

Source Error:

Line 28: & "')"
Line 29: DBAdd.Connection = DBConn
Line 30: DBAdd.Connection.Open
Line 31: DBAdd.ExecuteNonQuery()
Line 32:


Source File: c:\inetpub\wwwroot\motorsolutions\register2.aspx Line: 30

Stack Trace:

[SqlException: SQL Server does not exist or access denied.]
System.Data.SqlClient.SqlConnection.Open() +761
ASP.register2_aspx.btn_click(Object Src, EventArgs E) in c:\inetpub\wwwroot\motorsolutions\register2.aspx:30
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1263


Version Information: Microsoft .NET Framework Version:1.0.3705.0; ASP.NET Version:1.0.3705.0


is there something wrong with my connection string...i'd really appreciate it if anyone out there could test my code...my MotorSolutions database consists of only 2 fields:Manufacturer and Model...anyway, if u can't too it's ok..any meaningful feedback will do..Thanking you in advance.
GeneralRe: HELP unable to connect to sql server Pin
Colin Angus Mackay19-Aug-05 0:21
Colin Angus Mackay19-Aug-05 0:21 
GeneralRe: an aside: localhost Pin
Scott Serl19-Aug-05 10:28
Scott Serl19-Aug-05 10:28 
GeneralRe: an aside: localhost Pin
Luis Alonso Ramos19-Aug-05 14:26
Luis Alonso Ramos19-Aug-05 14:26 
GeneralRe: an aside: localhost Pin
Scott Serl20-Aug-05 7:29
Scott Serl20-Aug-05 7:29 
GeneralThank you Pin
christy1819-Aug-05 18:06
christy1819-Aug-05 18:06 
GeneralRe: HELP unable to connect to sql server Pin
Rob Graham20-Aug-05 4:01
Rob Graham20-Aug-05 4:01 
GeneralUsing Check Boxes Pin
Binary011018-Aug-05 8:52
Binary011018-Aug-05 8:52 
GeneralRe: Using Check Boxes Pin
Christian Graus18-Aug-05 17:01
protectorChristian Graus18-Aug-05 17:01 
GeneralRe: Using Check Boxes Pin
Binary011018-Aug-05 20:44
Binary011018-Aug-05 20:44 
GeneralRe: Using Check Boxes Pin
toxcct18-Aug-05 20:37
toxcct18-Aug-05 20:37 
GeneralRe: Using Check Boxes Pin
miah alom19-Aug-05 6:42
miah alom19-Aug-05 6:42 
GeneralAbstraction Layer Factory Tool Pin
Tristan Rhodes18-Aug-05 2:26
Tristan Rhodes18-Aug-05 2:26 
GeneralRe: Abstraction Layer Factory Tool Pin
miah alom19-Aug-05 6:27
miah alom19-Aug-05 6:27 
GeneralRe: Abstraction Layer Factory Tool Pin
airbus38021-Aug-05 2:37
airbus38021-Aug-05 2:37 
GeneralHelp with crystal reports!!!! Pin
korso_rogan17-Aug-05 23:39
korso_rogan17-Aug-05 23:39 
GeneralCannot open backup device Pin
dhtuan17-Aug-05 22:21
dhtuan17-Aug-05 22:21 
Generalusing describe with MS Access Pin
mhmo17-Aug-05 6:57
mhmo17-Aug-05 6:57 

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.