Hi everyone. I am having this error message
"Request for the permission of type 'System.Data.OleDb.OleDbPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
when i am openning the connection on an Access database when trying to populate a combo box. I have tried it locally and on one of the network drive. Here is my code :
Can anyone help me please
"Request for the permission of type 'System.Data.OleDb.OleDbPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
when i am openning the connection on an Access database when trying to populate a combo box. I have tried it locally and on one of the network drive. Here is my code :
VB.NET:
Private Sub frmPrintSearch_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Cmd As OleDb.OleDbCommand
Dim Conn As OleDb.OleDbConnection
Dim Sql As String = Nothing
Dim Reader As OleDb.OleDbDataReader
Dim ComboRow As Integer = -1
Dim Columns As Integer = 0
Dim Category As String = Nothing
cmbType.Items.Clear()
Conn = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=N:\Supply\Admininstration and Management\temp\unss.mdb")
Sql = " Select PrintAccType FROM DropDownList Order By PrintAccType Asc"
Cmd = New OleDb.OleDbCommand(Sql, Conn)
Try
Conn.Open()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Reader = Cmd.ExecuteReader()
While Reader.Read()
For Columns = 0 To Reader.FieldCount - 1
Category = Reader.Item(Columns)
Next
cmbType.Items.Add(Category)
ComboRow += 1
End While
Conn.Close()
End Sub
Can anyone help me please