|
-
Jun 29th, 2004, 10:15 AM
#1
Thread Starter
Fanatic Member
Insert row into SQL table using webform
I know how to do inserts with a windows app but this is my first web app and I have not had alot of luck. I have a form with lots of textboxs and a submit button. For trial purposes, I am only going to submit 3 of the textboxes. Here is the code,
VB Code:
Imports System.data.sqlclient
Imports System.Data
Public Class Identification
Inherits System.Web.UI.Page
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim cnCF98 As New SqlConnection
cnCF98.ConnectionString = "integrated security=true;initial catalog=tempdb"
cnCF98.Open()
Dim cmdtext As String = "Insert ID ( SN, Surname, Given) VALUES (" & txtSN.Text & ", " & txtSurname.Text & ", " & txtGiven.Text & " )"
Dim cm As New SqlCommand(cmdtext, cnCF98)
cm.ExecuteNonQuery()
cnCF98.Close()
End Sub
End Class
I get this error -
Server Error in '/WebApplication1' 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 110:
Line 111: cnCF98.ConnectionString = "integrated security=true;initial catalog=tempdb"
Line 112: cnCF98.Open()
Line 113:
Line 112 is in red. I am sure this is probably a security setup problem but have had no luck. I have added the
<identity impersonate="true" /> to the webconfig file but no luck with that either. Any help would be a good thing.
-
Jun 29th, 2004, 10:20 AM
#2
Hyperactive Member
your connection string does not point to a server
Try this
VB Code:
cnCF98.ConnectionString = "integrated security=SSPI;data source=computername;initial catalog=tempdb"
Last edited by CyberHawke; Jun 29th, 2004 at 10:25 AM.
-
Jun 29th, 2004, 10:39 AM
#3
Thread Starter
Fanatic Member
WOW, look at a problem hard and you cannot see the trees for the forest. THanks, That was just plain dumb on my part.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|