Thanks River Guy.
I am new at vb.net.
Here is what a developer wrote for me that gets me started.
with the way he is connecting to the ms sql db (below), will I be able to use the above aproach that RiverGuy gave me?
The form has a cbo box that fills all user tables in the database. then when the users selects a table, they hit a green arrow button to display its rows and columns in the dataGridView. The update,delete, and insert of any changes to cells in the grid he has graciously left to me tomake happen. I am sure he is testing me.
RiverGuys aproach sounds to good to be true, but I am sure it will work, I just can't seem to put any dots after the dataGridView1 to see an update,insert, or delete in intellesense.
can someone help?
Here is the code he has started me with:
Imports System.Data.SqlClient
Public Class frmUserTables
Private sqldb As New SqlDataProvider.clsDatabase(MDICatvMain.CommonData.ConnString)
Private Sub frmUserTables_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
LoadUserTables() '
Catch ex As Exception
MsgBox(ex.Message & " Load User Tables")
End Try
End Sub
Private Sub ToolStripGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripGo.Click
GetTable(ToolStripcboTables.SelectedText.ToString) 'the green arrow button
End Sub
Private Sub GetTable(ByVal strTable As String)
Dim params(0) As SqlParameter
params(0) = New SqlParameter("@table_name", SqlDbType.VarChar)
params(0).Value = strTable
Dim dr As DataSet = sqldb.FillDataset("sp_GetUserTable ", CommandType.StoredProcedure, params)
dgvTables.DataSource = dr
dgvTables.DataMember = "Table"
End Sub
Private Sub LoadUserTables()
'ToolStripcboTables.Rows.Clear()
Dim sSQL As String = "SELECT * FROM vw_UserTables"
Dim objDataReader As SqlDataReader
objDataReader = sqldb.ExecuteReader(sSQL, CommandType.Text)
If objDataReader.HasRows Then
With ToolStripcboTables
.Items.Add("<Select a Table to View>") 'puts at top of drop down
Do While objDataReader.Read()
.Items.Add(objDataReader(0).ToString.Trim) 'loops and populates dropdown
Loop
.SelectedIndex = 0 'sets dropdown index to start at first one which is ....Items.Add("<Select a Table to View>")
End With
End If
End Sub