Question : Setting the Caption Property of Buttons on a Form based on the Contents of a Field in an SQL Server Express Edition Database Table

This question is very similar in theme to one of previous questions on this forum.
I have a table (named ClientNames) in an SQL Server Express Database which has the following two fields:

Client ID and Client Name.

I have a Form1 in one of my Visual Basic Project in Visual Studio 2008. This form has three Buttons on it, named Button1, Button2 and Button3.
I need help with code for the initialise event of this form which will result in Button1, Button2 and Button3 getting their Caption property from the ClientName Fields in this table in an alphabetical order.

So if the there at present three records in this table   with  ClientName    Peter,   Mary and  Clare   then when Form1 Loads up, the caption of Button1 should be Clare, caption of Button2 should be Mary and the Caption of Button3 should be Peter.

The name and location of my Database is as follows:

I suppose the code for this purpose will first need to sort the table based on the Field ClientNames and then get the values of these fields and assign them to the caption property of Button1, Button2 and Button3 as Form1 Loads up.

The solution to my previous question on this theme works very well, but it was for a VBA project for Word and it pulled data from Access Database.
The solution I need now is for Visual Studio Project (using Visual Basic) and it needs to pull data from an SQL Server Express Edition Database using SQLClient.
I have got code that pulls data from an SQL Server table field. I need a modification of this code or some new code that will achieve the previously described objective for me.
The connection string for connecting to my SQL Server Express Database is as follows:
ConnectionString = "Data Source=VISTA-ON-MAC\SQLEXPRESS;Initial Catalog=WriterDemo;Persist Security Info=True;User ID=sa;Password=peter;Connect Timeout=30"

The code that I am providing in the Code window pulls one ClientName from ClientNames Table into a textbox  named txtNotes on a Form  in my project.

The code that solved my previous problem on this theme is here:
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_26164384.html

Many thanks for your help in anticipation.
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:
Imports System.Data
Imports System.Configuration
Imports System.Data.SqlClient
Public Class ViewClientNames

    Dim sqlConn As New SqlConnection
    Private mySQLConnection As New SqlConnection
    Private mySQLDataAdapter As SqlDataAdapter
    Private mySQLCommandBuilder As SqlCommandBuilder
    Private myDataTable As New DataTable
    Private RowPosition As Integer
    Private Sub ViewClientNames_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
        mySQLConnection.Close()
        mySQLConnection.Dispose()
    End Sub
    Private Sub ViewClientNames_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        mySQLConnection.ConnectionString = "Data Source=VISTA-ON-MAC\SQLEXPRESS;Initial Catalog=WriterDemo;Persist Security Info=True;User ID=sa;Password=peter;Connect Timeout=30"
        mySQLConnection.Open()
        mySQLDataAdapter = New SqlDataAdapter("SELECT note FROM ClientNames", mySQLConnection)
        mySQLCommandBuilder = New SqlCommandBuilder(mySQLDataAdapter)
       
        mySQLDataAdapter.Fill(myDataTable)
        Me.ShowCurrentRecord()
    End Sub
    Private Sub ShowCurrentRecord()
        If myDataTable.Rows.Count = 0 Then
            txtNotes.Text = ""
            Exit Sub
        End If
        txtNotes.Rtf = myDataTable.Rows(RowPosition)("ClientName").ToString()
       

    End Sub

Answer : Setting the Caption Property of Buttons on a Form based on the Contents of a Field in an SQL Server Express Edition Database Table

The PS4000X is a pure SAN (it only does iSCSI over Ethernet) while the NX4 is a 'unified' system, and has the potential to replace not only your existing SAN but also your NAS/file servers as you can host shares on it. The NX4 also supports fibre channel if you ever wanted to move in that direction.

Other than the hardware differences, the management interface is where you spend 99% of your time and of the two products I would go for the Equallogic. EMC has taken its mid-90's interface (and thinking) and sqaushed it into a new system so its awkward to do stuff that should be easy.

If you could, I would go for a NetApp, one of the smaller FAS2020 or FAS2040 models. THese will gove you everything that your current 2 choices give, but also has ASIS (deduplicaton) meaning you save if you deploy virtual machines or many files with similar data (think Word and Powerpoint document metadata etc). THese saving alone can cancel out the slightly higher cost of the product, and the management interface is acutally really good.
Random Solutions  
 
programming4us programming4us