.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old March 12th, 2003, 01:10 AM
aya aya is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 5 aya User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
update

i'm trying to update but every time i click the edit button it gives me this error<br>No value given for one or more required parameters<br>i went over the codes over and over but couldn't fine the problem plz help<br><br><%@ Import Namespace="System.Data" %><br><%@ Import Namespace="System.Data.OLEDB" %><br><HTML><br> <HEAD><br> <title>Untitled</title><br> <meta name="GENERATOR" Content="ASP Express 2.1"><br> <script language="VB" runat="server"><br><br>Dim strASS_Code, strASS_Description, strASS_Notes as string<br>Dim strConn as string = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Inetpubwwwrootdelete asset inwinfix.mdb;"<br><br>Sub Page_Load(Source as Object, E as EventArgs)<br> if not Page.IsPostBack then<br> BindData<br> End If<br>End Sub<br><br>Sub BindData()<br> Dim OLEDB as string = "Select ***_Code, ***_Description, ***_Notes from Asset"<br> Dim conn as New OLEDBConnection(strConn)<br> Dim Cmd as New OLEDBCommand(OLEDB, conn)<br> Dim objDR as OLEDBDataReader<br> conn.Open()<br> objDR=Cmd.ExecuteReader(system.data.CommandBehavio r.CloseConnection)<br> list1.datasource=objDR<br> list1.DataValueField="***_Description" <br> list1.datatextfield="***_Code" <br> list1.databind<br> list1.selectedindex=0<br>End Sub<br><br>Sub EditRecord(Source as Object, E as EventArgs)<br> Dim OLEDB as string = "Select ***_Code, ***_Descritpion, ***_Notes from Asset Where ***_Code = '" & list1.selecteditem.value & "'"<br> Dim conn as New OLEDBConnection(strConn)<br> Dim objDR as OLEDBDataReader<br> Dim Cmd as New OLEDBCommand(OLEDB, conn)<br> conn.Open()<br> objDR=Cmd.ExecuteReader(system.data.CommandBehavio r.CloseConnection)<br> While objDR.Read()<br> strASS_Code=objDR("***_Code")<br> strASS_Description=objDR("***_Description")<br> strASS_Notes=objDR("***_Notes")<br> End While<br> page.databind()<br> label1.text=""<br> label2.text=""<br>End Sub<br><br>Sub doUpdate(Source as Object, E as EventArgs)<br> Dim MySQL as string = "Update Asset Set ***_Description=@***_Description, ***_Notes=@***_Notes Where ***_Code=@***_Code"<br> Dim Conn as New OLEDBConnection(strConn)<br> Dim Cmd as New OLEDBCommand(MySQL, Conn)<br> cmd.Parameters.Add(New OLEDBParameter("@***_Code", frmASS_Code.text))<br> cmd.Parameters.Add(New OLEDBParameter("@***_Description", frmASS_Description.text))<br> cmd.Parameters.Add(New OLEDBParameter("@***_Notes", frmASS_Notes.text))<br><br> Conn.Open()<br> cmd.ExecuteNonQuery<br> label1.text = "It's Done!"<br><br> label1.text="Successfully updated -- - "<br> BindData<br> list1.SelectedIndex=List1.Items.IndexOf(List1.Item s.FindByValue(frmASS_Code.text))<br><br>End Sub<br> </script><br> </HEAD><br> <body><br> <form Name="form1" runat="server" ID="Form1"><br> <table border="1" width="100%"><br> <tr><br> <td align="middle" width="145" valign="top"><b><i>Choose from List:</i></b><br><br> <asp:ListBox id="list1" Width="217px" height="150px" runat="server" /><br><br> <br> <asp:button id="button1" Text="Edit Record" onclick="EditRecord" runat="server" Width="104px" /><br> </td><br> <td align="left" valign="top"><br> <b>Code :</b><br> <asp:textbox id="frmASS_Code" Text="<%# strASS_Code %>" runat="server" Width="358px"/><br><br> <b>Description : </b><br> <asp:textbox id="frmASS_Description" Text="<%# strASS_Description %>" runat="server" Width="317px"/><br><br> <b>Notes : </b><br> <asp:textbox id="frmASS_Notes" runat="server" Text="<%# strASS_Notes %>" Width="354px"/><br><br> <br><br> <br><br> <asp:button id="button2" Text="Update" onclick="doUpdate" runat="server" /><br> <i><br> <asp:Label ID="label1" forecolor="red" runat="server" /></i><br><br> <i><br> <asp:Label ID="label2" runat="server" /></i><br> </td><br> </tr><br> </table><br> </form><br> </body><br></HTML>

Reply With Quote
Reply

Viewing: ASP Free ForumsProgramming.NET Development > update


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT