 |
| ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

April 7th, 2005, 07:49 AM
|
|
Friend of Wrox
|
|
Join Date: Apr 2004
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
inserting data
hi all,
My problem is this:
1- the user puts the info in the boxes.
2- hits the button, the event is fired.
3- the information is put into the database and then a hidden panel.
4- hidden panel is revealed and the panel they entered the info into disappears.
However nothing is showing in the database. No errors are thrown out and the connection string is right. Never had this problem before.
Thanks for help.
David Jenkins
-------------------------------------------------------------
Do you want to make extra money around your commitments?
Credit cards, bills, loans and a mortgage - all getting you down?
Is your pension going to be enough when you retire?
There is a solution visit http://www.1stmillion.co.uk
or call 01772 489521
__________________
David Jenkins
|
|

April 7th, 2005, 10:09 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Please post your code.
|
|

April 7th, 2005, 10:51 AM
|
|
Friend of Wrox
|
|
Join Date: Apr 2004
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
just included the script code and no html. shout if you need that aswell.
cheers for the help.
Code:
<%@ Page Language="VB" %>
<%@ import Namespace="System.Data.OleDb" %>
<script runat="server">
' When the sign buttopn is pushed it stores the message into the database...
Sub btnSign_Click(sender As Object, e As EventArgs)
Dim connectionString as string = "Provider=Microsoft.Jet.OLEDB.4.0; Ole DB Services=-4; Data Source=C:\Inetpub\wwwroot\guestbook\admin\database\database.mdb"
Dim dbConnection As New OleDbConnection(connectionString)
dbConnection.Open()
Dim commandString as string = "INSERT INTO tbl_Messages (MessageFrom, MessageFromUrl, MessageFromEmail, MessageDate, Message, CustomField1, CustomField2, CustomField3) Values(@MessageFrom, @MessageFromUrl, @MessageFromEmail, @MessageDate, @Message, @CustomField1, @CustomField2, @CustomField3)"
Dim dbCommand as New OleDbCommand(commandString, dbConnection)
dbCommand.Parameters.Add("@MessageFrom", OleDbType.VarChar, 30).Value = txtName.Text
dbCommand.Parameters.Add("@MessageFromUrl", OleDbType.VarChar, 30).Value = txtHomepage.Text
dbCommand.Parameters.Add("@MessageFromEmail", OleDbType.VarChar, 30).Value = txtEmail.Text
dbCommand.Parameters.Add("@MessageDate", OleDbType.VarChar, 12).Value = lblDate.Text
dbCommand.Parameters.Add("@Message", OleDbType.VarChar, 1000).Value = txtMessage.Text
dbCommand.Parameters.Add("@CustomField1", OleDbType.VarChar, 50).Value = txtCustom1.Text
dbCommand.Parameters.Add("@CustomField2", OleDbType.VarChar, 50).Value = txtCustom2.Text
dbCommand.Parameters.Add("@CustomField3", OleDbType.VarChar, 50).Value = txtCustom3.Text
dbConnection.Close()
'This shows the messages...
showMessage.Visible = "True"
'this sets the values from the ones they just out in...
lblName.Text = txtName.Text
lblHomepage.Text = txtHomepage.Text
lblEmail.Text = txtEmail.Text
lblMessage.Text = txtMessage.Text
lblCustom11.Text = lblCustom1.Text
lblCustom22.Text = lblCustom2.Text
lblCustom33.Text = lblCustom3.Text
lblCustom1res.Text = txtCustom1.Text
lblCustom2res.Text = txtCustom2.Text
lblCustom3res.Text = txtCustom3.Text
lblPOsted.Visible = "True"
signMessages.Visible = "False"
End Sub
'When the reset button is pushed the following resets all the txtboxes to nothing...
Sub btnReset_Click(sender As Object, e As EventArgs)
txtName.Text = ""
txtHomepage.Text = ""
txtEmail.Text = ""
txtMessage.Text = ""
If txtCustom1.Visible then
txtCustom1.Text =""
End If
If txtCustom2.Visible then
txtCustom1.Text =""
End If
If txtCustom3.Visible then
txtCustom1.Text =""
End If
End Sub
</script>
David Jenkins
-------------------------------------------------------------
Do you want to make extra money around your commitments?
Credit cards, bills, loans and a mortgage - all getting you down?
Is your pension going to be enough when you retire?
There is a solution visit http://www.1stmillion.co.uk
or call 01772 489521
|
|

April 8th, 2005, 07:19 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
I'm not seeing where you are executing the update.
Something like dbCommand.ExecuteNonQuery()
|
|

April 8th, 2005, 11:15 AM
|
|
Friend of Wrox
|
|
Join Date: Apr 2004
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
ok istuck that in and now throws. Must use an updateable query... but it seems ok???
David Jenkins
-------------------------------------------------------------
Do you want to make extra money around your commitments?
Credit cards, bills, loans and a mortgage - all getting you down?
Is your pension going to be enough when you retire?
There is a solution visit http://www.1stmillion.co.uk
or call 01772 489521
|
|

April 8th, 2005, 11:51 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Does the ASPNET user account have write permissions on the 'database' folder?
|
|

April 9th, 2005, 03:38 AM
|
|
Friend of Wrox
|
|
Join Date: Apr 2004
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Cheers Stu you always give good advice! Its a new pc and new install. So I hadnt
set any permissions and a few security tweaks to my system where wrong. Completley
went out of mind head.
Thanks for the assist.
David Jenkins
-------------------------------------------------------------
Do you want to make extra money around your commitments?
Credit cards, bills, loans and a mortgage - all getting you down?
Is your pension going to be enough when you retire?
There is a solution visit http://www.1stmillion.co.uk
or call 01772 489521
|
|
 |