Dim ADP As SqlDataAdapter = New SqlDataAdapter
            Dim CONN As SqlConnection = New SqlConnection("Data Source=|DataDirectory|\dbTesting.sdf")
            Dim COMM As SqlCommand = New SqlCommand("SELECT * FROM tbTesting")
            Dim DS As New DataSet
            CONN.Open()
            Dim DR As SqlDataReader = COMM.ExecuteReader()
            DR = COMM.ExecuteReader()
            TextBox0.Text = DR("Test").ToString



This was my coding in order to display the value of a field named'Test' 

Is my codings correct? If Yes or No, Why does my program HANG? As in...my system doesnt respond...But somehow Visual studio Functioning well...So I guess the problem is within my program once I executed the button that contains the above codings...
Any help would be appreciated...Thanks...

Just off hand you call the ExecuteReader twice. You also have to get the value of the field from an ordinal and value while casting it to the typw you expect.

Oh...How do I do that?...
...anyway, I removed the "DR = COMM.ExecuteReader()" But still my program Hangs...

No It Didn't...It Just Hangs And Do Not Respond Whenever I Execute The Code Above...
:-/

By The Way, Some AdditonalInfo Of My Database
...
Provider=Microsoft SQL Server Compact
...

From MSDN

Private Sub RetrieveMultipleResults(ByVal connection As SqlConnection)
    Using connection
        Dim command As SqlCommand = New SqlCommand( _
          "SELECT CategoryID, CategoryName FROM Categories;" & _
          "SELECT EmployeeID, LastName FROM Employees", connection)
        connection.Open()

        Dim reader As SqlDataReader = command.ExecuteReader()

        Do While reader.HasRows
            Console.WriteLine(vbTab & reader.GetName(0) _
              & vbTab & reader.GetName(1))

            Do While reader.Read()
                Console.WriteLine(vbTab & reader.GetInt32(0) _
                  & vbTab & reader.GetString(1))
            Loop

            reader.NextResult()
        Loop
    End Using
End Sub

Oh Thanks for the reply...But I Still Getting Error
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

By The Way...With The First Coding That I Post...I Manage To Got Some Response But This...Can Not Open Connection!

...It Seems Like VB Can't Open My Database
...So I Open My Server Explorer And I Saw My Database Marked 'x' Means 'Close' Right?...I Click On It And Refresh It Then Its State Became 'Open'...But When I Hit F5 For Testing...It Closes Itself... :-/ ???

You must have something missing or wrong in your connection string. You need to just set up event to open and close your connection wrapped in a try catch block to see what's wrong with it.

 Try
         conn.open
         msgbox(conn.ConnectionString & VBCRLF & "Connection Open")
        Catch ex As Exception
         msgbox(ex.tostring)
        Finally
         conn.Close
        End Try

Edited 4 Years Ago by kRod: Formatting

Sorry...Took Me So Long To Reply...Got Tons Of Stuff To Finish...Anyway, I Think I Give Up Using This SQL Compact...I Use Now Microsoft Access OLE DB Instead...
Thanks For All The Reply...
...But Now I'm Facing A New Problem...
Indeed, As I Said,IAm Using Microsoft Access...
SoI SuccessfullyEstablished And Connect My Database...
...And Also I Got Successfully Recorded My Data Through Update Command...And The Display As My Indicator Indicates That The Value Is Change...
But The Problem Was...After I Hit "Ctrl+S" or "Save"...To Save My Entire Project...The Record Seems To Reset To The Valiue That I Initially Set Them When I Created The Database...My Indicator Also Displays The Value Which Means It Roll Backs To Its Former Value...Also When I Open The Database...The Value Still Teh Same...Why Do You Think It's Happening?

These Are My Declaration:

Public conn As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\dbAccount.accdb")
Public Cmd As New OleDbCommand
Public DataSet As New DataSet()
Public DataReader As OleDbDataReader
Public DataAdapter As OleDbDataAdapter = New OleDbDataAdapter()

These Are My Codings To Save To Database...

Cmd = New OleDbCommand("UPDATE tbAccount SET clr1=1", conn)
conn.Open()
Cmd.ExecuteNonQuery()
conn.Close()

All Right My Bad...:-)
Found Out The Problem...I Guess...
...During The Testing Of The System...The VB Creates A Temporary Copy Of The Original Database...So Therefore...The Database That Takes The Changes Was The Temporary One...That's Why...There's No Change On The Actual Database...

This article has been dead for over six months. Start a new discussion instead.