Hi Pete
Imports System.Data
Imports System.Configuration
Imports System.Data.OleDb
Imports System.Data.SqlClient
Imports System.Linq
Public Class Window12
Private COURSES_PLAYEDData As New CoursesPlayedDataSet
Private taCOURSES_PLAYED As New CoursesPlayedDataSetTableAdapters.COURSES_PLAYEDTableAdapter
Private taManager As New CoursesPlayedDataSetTableAdapters.TableAdapterManager
Private Placeholder As String
Private view As CollectionView
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
Call connmethod()
' Add any initialization after the InitializeComponent() call.
End Sub
Public Sub connmethod()
End Sub
Private Sub COURSEDataGridView_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles COURSEDataGridView.CellContentClick
End Sub
Private Sub Window12_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'TODO: This line of code loads data into the 'CoursesPlayedDataSet.Coursesplayed ' table. You can move, or remove it, as needed.
Me.CourseTableAdapter.Fill(Me.CourseDataSet1.COURSE)
'Me.CourseS_PLAYEDTableAdapter.Fill(Me.CoursesPlayedDataSet.COURSES_PLAYED)
End Sub
Function GetData(ByVal queryString As String) As DataSet
' Retrieve the connection string stored in the Web.config file.
Dim connectionString As String = ConfigurationManager.ConnectionStrings("WpfDataEntry.MySettings.VB_DAVE_1__mainConnectionString").ConnectionString
Dim ds As New DataSet()
Try
' Connect to the database and run the query.
Dim connection As New SqlConnection(connectionString)
Dim adapter As New SqlDataAdapter(queryString, connection)
' Fill the DataSet.
adapter.Fill(ds)
Catch ex As Exception
' The connection failed. Display an error message.
MsgBox("Unable to connect to the database.")
End Try
Return ds
End Function
Private Sub BindingNavigatorAddNewItem_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorAddNewItem.Click
Me.BindingNavigatorAddNewItem.Select()
Me.Prikey3DataGridViewTextBoxColumn.DataGridView.Select()
Me.taManager.UpdateAll(Me.CoursesPlayedDataSet)
CoursesPlayedDataSet.AcceptChanges()
Dim newWindow12 = New Window12
Me.Close()
Dim newWindow3 = New Window3
newWindow3.Show()
End Sub
Private Sub COURSESPLAYEDBindingSource_CurrentChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles COURSESPLAYEDBindingSource.CurrentChanged
End Sub
End Class
This if the code behind which runs my Datgrid view to select a new course from Courses and put the selected line into
Courses-played.
It dosent work and I dont know how to code it to run or call the insert command from the CoursesPlayedDataset
Thanks David