I 'm doing an application using vb.net 2008 and sql 2005 i want to know whether it is possible load data into message box from database when form is loaded......

Recommended Answers

Post your code. How far you doing this and we try to help you.

Jump to Post

All 2 Replies

Post your code. How far you doing this and we try to help you.

Thank you very much
i'm not genius vb so i wrote the coding like this
I wrote this coding to Form Load event

Dim BName as String
myCommand2 = New SqlCommand(" Select Reg_No FROM Student Where Name= 'sa' ", myConnection)
        Dim dr As SqlDataReader = myCommand2.ExecuteReader
        While dr.Read()


            BName = dr(0).ToString

            'currentbalance = Double.Parse(dr(2).ToString)

        End While
        dr.Close()
        MessageBox.Show("Name:", BName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information

there was no errors but the message box is also not displaying..........
this the data table i used..........

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.