Form to Database

J

jblaze

Hi. I am creating an asp.net form page that my customer service reps
can use to use on follow up calls to our customers.

Essentially, the reps will answer yes/no questions in a drop-down list
or checkbox format along with adding comments. I would like this to
write into either a Access or SQL Server database.

The problem that I am having is that when I preview the page, using
ASP.NET web matrix it works, however when I publish the site on IIS 6
it does not.

Here is what i have so far.

Sub Page_Load(sender As Object, e As EventArgs)
If Page.IsPostBack Then
InsertRecord()
End If
End Sub
Sub InsertRecord()
Dim conclasf As OleDbConnection
Dim cmdClasf As New OleDbCommand
Dim strClasf As String
Dim strSQL As String
Dim intRowsAff As Integer



lblErrMsg.Text = ""
lblRecsAff.Text = ""
strClasf = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data
Source=\\IPADDRESS\access\MIS\dbCustomerService.mdb"
conClasf = New OleDbConnection(strClasf)
conClasf.Open

strSQL = "INSERT INTO DeliveryQuestionnaire
([CustomerCode],[TruckNumber],[ProperDress],[Cautious],[SpecialDelivery],
[Comments]) values ('" & CustomerCode.Value & "', " &
TruckNumber.Value &", " & ProperDress.SelectedItem.Text &", " &
Cautious.SelectedItem.Text & ", " & SpecialDelivery.SelectedItem.Text
&", '" & Comments.Text &"')"

cmdClasf = New OleDbCommand(strSQL, conClasf)
Try
intRowsAff = cmdClasf.ExecuteNonQuery()
Catch ex As Exception
lblErrMsg.Text = ex.Message
End Try
lblRecsAff.Text = intRowsAff & " record(s) inserted using " &
strSQL
conClasf.Close
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,088
Latest member
JeremyMedl

Latest Threads

Top