richasr87:
returns the record blank.
Is something getting into the database?
Maybe this will help.
http://forums.asp.net/p/1116521/1732954.aspx#1732954
as i understand that you have no problem with the insert statement, but the REG field is not assigned. there for debug you project and check the data that comes from the textbox. the problem seems that the textbox is not assigned with the REG field.
mohi88:
as i understand that you have no problem with the insert statement, but the REG field is not assigned. there for debug you project and check the data that comes from the textbox. the problem seems that the textbox is not assigned with the REG field.
I'm very new to Web Developer and I've downloaded the 2008 Beta2 which I think, ironically, has a bug when you try to debug.
Though that may be that I don't know what i'm doing properly, any chance you could run me through it? I cannot insert a breakpoint for whatever reason.
well you can but a button and make the button show messagebox whichwill give you the text inside the textbox! in this way you can see ifthe text box hold some text inside it after you enter the text andclick the button. and after that when you see the text on the messagebox. remove the messagebox code and check the you have assigned the thetextbox.text with your REG.
if you can send the code paragraph, i will try to help you better.
You can try using the F9 key to insert breakpoints when you are in the code view. Also, I would recommend going thru my previous post.
bullpit:
You can try using the F9 key to insert breakpoints when you are in the code view. Also, I would recommend going thru my previous post.
I used the forum topic you left for me before I posted this one, It only answered the error message I was receiving and the problem still occured, however all other text boxes are adding data to the database, just the Reg field is being neglected.
My code (Sorry i'm posting the whole aspx page source, I'm still learning
):
<%@.PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="_Default" %>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title>Untitled Page</title></head>
<body>
<formid="form1"runat="server">
<div>
</div>
<asp:FormViewID="FormView1"runat="server"DataKeyNames="UsID"DataSourceID="AccessDataSource1"AllowPaging="True">
<EditItemTemplate>
UsID:
<asp:LabelID="UsIDLabel1"runat="server"Text='<%# Eval("UsID") %>'/>
<br/>
Reg:
<asp:TextBoxID="RegTextBox"runat="server"Text='<%# Bind("Reg") %>'/>
<br/>
Surname:
<asp:TextBoxID="SurnameTextBox"runat="server"Text='<%# Bind("Surname") %>'/>
<br/>
Course:
<asp:TextBoxID="CourseTextBox"runat="server"Text='<%# Bind("Course") %>'/>
<br/>
Entry:
<asp:TextBoxID="EntryTextBox"runat="server"Text='<%# Bind("Entry") %>'/>
<br/>
<asp:LinkButtonID="UpdateButton"runat="server"CausesValidation="True"CommandName="Update"Text="Update"/>
<asp:LinkButtonID="UpdateCancelButton"runat="server"CausesValidation="False"CommandName="Cancel"Text="Cancel"/>
</EditItemTemplate>
<InsertItemTemplate>
Reg:
<asp:TextBoxID="RegTextBox"runat="server"Text='<%# Bind("Reg") %>'/>
<br/>
Surname:
<asp:TextBoxID="SurnameTextBox"runat="server"Text='<%# Bind("Surname") %>'/>
<br/>
Course:
<asp:TextBoxID="CourseTextBox"runat="server"Text='<%# Bind("Course") %>'/>
<br/>
Entry:
<asp:TextBoxID="EntryTextBox"runat="server"Text='<%# Bind("Entry") %>'/>
<br/>
<asp:LinkButtonID="InsertButton"runat="server"CausesValidation="True"CommandName="Insert"Text="Insert"/>
<asp:LinkButtonID="InsertCancelButton"runat="server"CausesValidation="False"CommandName="Cancel"Text="Cancel"/>
</InsertItemTemplate>
<ItemTemplate>
UsID:
<asp:LabelID="UsIDLabel"runat="server"Text='<%# Eval("UsID") %>'/>
<br/>
Reg:
<asp:LabelID="RegLabel"runat="server"Text='<%# Bind("Reg") %>'/>
<br/>
Surname:
<asp:LabelID="SurnameLabel"runat="server"Text='<%# Bind("Surname") %>'/>
<br/>
Course:
<asp:LabelID="CourseLabel"runat="server"Text='<%# Bind("Course") %>'/>
<br/>
Entry:
<asp:LabelID="EntryLabel"runat="server"Text='<%# Bind("Entry") %>'/>
<br/>
<asp:LinkButtonID="EditButton"runat="server"CausesValidation="False"CommandName="Edit"Text="Edit"/>
<asp:LinkButtonID="DeleteButton"runat="server"CausesValidation="False"CommandName="Delete"Text="Delete"/>
<asp:LinkButtonID="NewButton"runat="server"CausesValidation="False"CommandName="New"Text="New"/>
</ItemTemplate>
</asp:FormView>
<asp:AccessDataSourceID="AccessDataSource1"runat="server"DataFile="c:\inetpub\wwwroot\WebSite\App_Data\db1.mdb"
DeleteCommand="DELETE FROM [table] WHERE [UsID] = ?"InsertCommand="INSERT INTO [table] ([Reg], [Surname], [Course], [Entry]) VALUES (?, ?, ?, ?)"
SelectCommand="SELECT * FROM [table]"UpdateCommand="UPDATE [table] SET [Reg] = ?, [Surname] = ?, [Course] = ?, [Entry] = ? WHERE [UsID] = ?">
<DeleteParameters>
<asp:parameterName="UsID"Type="Int32"/>
</DeleteParameters>
<UpdateParameters>
<asp:parameterName="Reg"Type="String"/>
<asp:parameterName="Surname"Type="String"/>
<asp:parameterName="Course"Type="String"/>
<asp:parameterName="Entry"Type="String"/>
<asp:parameterName="UsID"Type="Int32"/>
</UpdateParameters>
<InsertParameters>
<asp:parameterName="UsID"Type="Int32"/>
<asp:parameterName="Reg"Type="String"/>
<asp:parameterName="Surname"Type="String"/>
<asp:parameterName="Course"Type="String"/>
<asp:parameterName="Entry"Type="String"/>
</InsertParameters>
</asp:AccessDataSource>
</form></body>
</html>
richasr87:
<InsertParameters>
<asp:parameterName="UsID"Type="Int32"/>
Remove this parameter from your markup.
*dumbfounded*
oddly enough, my dad and I were saying it would be something extremely simple and trivial and thats what it was.
It works now thankyou very much, I believed that I had to keep that parameter in order for the autonumber to update aswell.
Thanks a lot for all your help, now for the meat of the site!![]()
Great! Njoi
Footnote: Your problem has been solved in that post that I recommended. Look at the last post of that user (and thats what I thought was your problem).
Ah, I should maybe increase the font size in future or something.
cheers!
No comments:
Post a Comment