Глобальная строка подключения
Привет я хочу перевестись
Dim connstring As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Jim Clinton Amarga\Desktop\Class Records\Class Records\bin\Debug\dbClassRecords.accdb"к модулю или классу
Что я уже пробовал:
Public Class frmAttendance Dim sqlcode As String Dim connstring As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\Jim Clinton Amarga\Desktop\Class Records\Class Records\bin\Debug\dbClassRecords.accdb" Sub loaddata() ListView.Items.Clear() Try sqlcode = "SELECT ID,A_Fname,A_Lname,A_Course,A_Subject,A_PDay1,A_PDay2,A_PDay3,A_PDay4,A_PDay5,A_PDay6,A_ScorePrelim FROM tblAttendance ORDER BY A_Lname ASC " Dim sqlcmd As New OleDb.OleDbCommand(sqlcode) sqlcmd.Connection = New OleDb.OleDbConnection(connstring) sqlcmd.Connection.Open() sqlcmd.ExecuteNonQuery() Dim da As New OleDb.OleDbDataAdapter(sqlcmd) Dim ds As New DataSet da.Fill(ds, " tblAttendance ") Dim itemcollection(100) As String For r = 0 To ds.Tables(" tblAttendance ").Rows.Count - 1 For c = 0 To ds.Tables(" tblAttendance ").Columns.Count - 1 itemcollection(c) = ds.Tables(" tblAttendance ").Rows(r)(c).ToString Next Dim LVI As New ListViewItem(itemcollection) ListView.Items.Add(LVI) Next Catch ex As Exception MessageBox.Show(ex.ToString) End Try End Sub
Karthik_Mahalingam
в чем была проблема