sql server - SQL To Text Box -


simple enough, i'm trying take information out of column in sql database members_id equal integer users inputs textbox.

  • sendfromid.text textbox containing members_id

  • current_points textbox want hold/show sql column info

  • u_g_studio sql column holding data

only 1 row can match members_id it's primary key.

this far i've managed code; after lost. if provide example in code i'd appreciate it.

stcon = "connection string;"         con = new sqlconnection(stcon)          con.open()          dim cmd new sqlcommand("select u_g_studio personsa members_id ='" & sendfromid.text & "'", con)         cmd.commandtype = commandtype.text 

{edit 1}

just want clarify, need download data from sql column into texbox.

try this. using automatically takes care of disposing resources. parameterize query avoid sql injection attacks.

stcon = "connection string;" dim strugstudio string  dim sql string = _ "select u_g_studio personsa members_id = @memberid"  using conn new sqlconnection(stcon)     dim cmd new sqlcommand(sql, conn)     cmd.parameters.addwithvalue("@memberid", sendfromid.text)     try         conn.open()         strugstudio = convert.tostring(cmd.executescalar())     catch ex exception         console.writeline(ex.message)     end try  end using   return strugstudio  

Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -