asp.net - Trouble passing results from DataReader to textbox -


i making admin section allow access several small sql tables in project.

i have repeaters set show lists button bring modal adding new entry or editing existing one. code behind stores value selected row, , query sql class return value fill text boxes. code works sql class , can display message box , proper results. can't pass value if query vb page fill text boxes.

here repeater

    <%--employee repeater--%> <asp:repeater id="repeater1" runat="server" datasourceid="sqldatasource1">     <headertemplate>             <table class="display" id ="employeelist">                 <thead>                 <tr>                     <th>                         name                     </th>                     <th>                         email                     </th>                     <th>                         update                     </th>                     </tr>                 </thead>         </headertemplate>      <itemtemplate>         <tr>             <td>                 <%# eval("name")%>             </td>             <td>                 <%# eval("email")%>             </td>             <td>                 <asp:button id="cmdeditname" runat="server" text="edit/delete" commandargument= '<%#databinder.eval(container.dataitem, "id")%>' onclick="editname"/>              </td>         </tr>     </itemtemplate>         <footertemplate>             </table>         </footertemplate>  </asp:repeater> 

my code behind

   'open name modal bound repeater     public sub editname(byval sender object, byval e system.eventargs)         dim wlink new button         edit = true         wlink = directcast(sender, button)         txteditid.text = wlink.commandargument          sql.runreader("select name admin_contacts admin_contacts.id = '" & txteditid.text & "' ")         txteditname.text = results          sql.runreader("select email admin_contacts admin_contacts.id = '" & txteditid.text & "' ")         txteditemail.text = results          modalname.show()      end sub 

and code in sql class

public function runreader(byval query string) string     dim results string = ""     try         sqlcon.open()         sqlcmd = new sqlcommand(query, sqlcon)         dim r sqldatareader = sqlcmd.executereader         while r.read             results = (r(0))             'msgbox show getting results             msgbox(results)         end while         sqlcon.close()     catch ex exception         msgbox(ex.message)         if sqlcon.state = connectionstate.open             sqlcon.close()         end if     end try 

 dim results = sql.runreader("select name admin_contacts admin_contacts.id = '" & txteditid.text & "' ")         txteditname.text = results 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -