Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. inserting info into text box?

inserting info into text box?

Scheduled Pinned Locked Moved Visual Basic
databasehelpquestion
2 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pandapatin
    wrote on last edited by
    #1

    im trying to retreave an information from a database after the person have logged in.but i can insert the data to a specific place that im intent to put it.Im using session to do that by passing the parameter to campare it. this is the code i used: Dim MyConn As SqlConnection Dim cmdSelect As SqlCommand userName = Session("userName") If userName <> "" Then MyConn = New SqlConnection(ConfigurationManager.AppSettings("psmConnectionString")) cmdSelect = New SqlCommand("sp_GetUser", MyConn) cmdSelect.CommandType = CommandType.StoredProcedure Dim parameternoPekerja As New SqlParameter("@noPekerja", SqlDbType.VarChar) parameternoPekerja.Value = userName cmdSelect.Parameters.Add(parameternoPekerja) MyConn.Open() Dim dr As SqlDataReader = cmdSelect.ExecuteReader(CommandBehavior.CloseConnection) If dr.HasRows = False Then ' error mesej Else txtnama.Text = CInt(dr("nama")) txtjawatan.Text = CInt(dr("jawatan")) txtjabatan.Text = CInt(dr("jabatan")) txtbidang.Text = CInt(dr("jabatan")) txtjabatan.Text = CInt(dr("jabatan")) End If Else 'error Is it wrong

    C 1 Reply Last reply
    0
    • P pandapatin

      im trying to retreave an information from a database after the person have logged in.but i can insert the data to a specific place that im intent to put it.Im using session to do that by passing the parameter to campare it. this is the code i used: Dim MyConn As SqlConnection Dim cmdSelect As SqlCommand userName = Session("userName") If userName <> "" Then MyConn = New SqlConnection(ConfigurationManager.AppSettings("psmConnectionString")) cmdSelect = New SqlCommand("sp_GetUser", MyConn) cmdSelect.CommandType = CommandType.StoredProcedure Dim parameternoPekerja As New SqlParameter("@noPekerja", SqlDbType.VarChar) parameternoPekerja.Value = userName cmdSelect.Parameters.Add(parameternoPekerja) MyConn.Open() Dim dr As SqlDataReader = cmdSelect.ExecuteReader(CommandBehavior.CloseConnection) If dr.HasRows = False Then ' error mesej Else txtnama.Text = CInt(dr("nama")) txtjawatan.Text = CInt(dr("jawatan")) txtjabatan.Text = CInt(dr("jabatan")) txtbidang.Text = CInt(dr("jabatan")) txtjabatan.Text = CInt(dr("jabatan")) End If Else 'error Is it wrong

      C Offline
      C Offline
      CooperWu
      wrote on last edited by
      #2

      pandapatin wrote:

      txtnama.Text = CInt(dr("nama")) txtjawatan.Text = CInt(dr("jawatan")) txtjabatan.Text = CInt(dr("jabatan")) txtbidang.Text = CInt(dr("jabatan")) txtjabatan.Text = CInt(dr("jabatan"))

      must call dr.Read() first...

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups