basic data read and put it on web form

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default basic data read and put it on web form

    i'm trying to read data from SQL Server database using
    data reader and assigned it to a label in my asp.net web
    application. but when the button is clicked, nothing
    appears. please help, thanks.

    Private Sub btnTesting_Click(ByVal sender As
    System.Object, ByVal e As System.EventArgs) Handles
    btnTesting.Click
    Dim cn As New SqlClient.SqlConnection
    Dim cm As New SqlClient.SqlCommand
    Dim dr As SqlClient.SqlDataReader
    cn.ConnectionString = _
    "data source=MHNAZLY;initial catalog=MEDICAL;"
    Try
    cn.Open()
    Try
    cm.Connection = cn
    cm.CommandText = "SELECT StaffID,
    StaffName, Designation, Contact_no, Email FROM
    Admin_Staff WHERE(StaffID='1001104214')"
    dr = cm.ExecuteReader()
    Try
    While dr.Read()

    'lblDoctorID.Text = dr.Item
    ("StaffID").ToString()
    lblDoctorID.Text = dr.GetString(1)
    End While
    Finally
    dr.Close()
    End Try
    Finally
    cn.Close()
    End Try
    Catch ex As Exception

    End Try
    End Sub
    mhnazly Guest

  2. Similar Questions and Discussions

    1. How read fields in pdf with Visual Basic 6
      How read fields in Pdf with Visual Basic 6, please?
    2. Very basic form validation question
      Tabla Junkie wrote: If you're on CFMX 7 you can validate it this way within a cfform block: <cfinput type="text" required="yes" validate="email"...
    3. basic submit form button
      Hi, I am trying to create a very simple form with the submit button. I am fairly new creating forms contected to mysql. I would think that once...
    4. Basic form to email - from field?
      I have a very basic short form on a website that works fine, but I'd like for the email "from" field to actually display the email address of the...
    5. Basic Problems with data
      Hi all, Sorry that this is such a basic question - I just can't seem to find the answer or the way of doing it myself! I'm pretty new to Flash...
  3. #2

    Default Re: basic data read and put it on web form

    Please see here. [url]http://www.aspfaq.com/5002[/url]

    Ray at home

    "mhnazly" <anonymous@discussions.microsoft.com> wrote in message
    news:06c401c39aa8$1b8c2b20$a301280a@phx.gbl...
    > Private Sub btnTesting_Click(ByVal sender As
    > System.Object, ByVal e As System.EventArgs) Handles
    > btnTesting.Click

    Ray at Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139