Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 7th, 2005, 07:49 AM
Friend of Wrox
 
Join Date: Apr 2004
Location: Preston, Lancashire, United Kingdom.
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to RPG SEARCH
Default 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
  #2 (permalink)  
Old April 7th, 2005, 10:09 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Please post your code.

  #3 (permalink)  
Old April 7th, 2005, 10:51 AM
Friend of Wrox
 
Join Date: Apr 2004
Location: Preston, Lancashire, United Kingdom.
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to RPG SEARCH
Default

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
  #4 (permalink)  
Old April 8th, 2005, 07:19 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
Default

I'm not seeing where you are executing the update.

Something like dbCommand.ExecuteNonQuery()


  #5 (permalink)  
Old April 8th, 2005, 11:15 AM
Friend of Wrox
 
Join Date: Apr 2004
Location: Preston, Lancashire, United Kingdom.
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to RPG SEARCH
Default

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
  #6 (permalink)  
Old April 8th, 2005, 11:51 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Does the ASPNET user account have write permissions on the 'database' folder?

  #7 (permalink)  
Old April 9th, 2005, 03:38 AM
Friend of Wrox
 
Join Date: Apr 2004
Location: Preston, Lancashire, United Kingdom.
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to RPG SEARCH
Default

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
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
inserting data stevens ADO.NET 0 May 13th, 2008 07:49 AM
Data inserting twice nuttylife2 ASP.NET 2.0 Professional 8 August 22nd, 2006 11:01 AM
Inserting data when data already exsist desireemm SQL Language 0 January 16th, 2006 11:01 PM
Inserting data into 2 tables chrscote Access ASP 1 August 1st, 2005 09:01 AM



All times are GMT -4. The time now is 11:21 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.