Hi ... I have a qurey. Plz Give me the solution

Hi ... I have a qurey. Plz Give me the solution

am 06.12.2007 06:31:30 von 1983.yadav

I m using C#.NET and i m connected with oracle with OLEDB. I m try to
add my user defined table in a list box from my MS-ACCESS databse.

My connection string to connect with MS-ACCESS is
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
txt_database_name.Text + ";"
where txt_database_name.Text is my .mdb path.

when i m excuting the query="SELECT MsysObjects.Name FROM MsysObjects
WHERE (([Type] = 1) AND ([Name] Not Like "+MSys+*"))ORDER BY
MsysObjects.Name"
through cmd.excutereader, i m getting an err i.e "Record(s) cannot
be read; no read permission on 'MsysObjects".

Plz suggest me the solution, if i need to change anythng in my
connection string, plz suggest or wht else i need to do and tell me
how to give permission to read MsysObjects.

Plz rply me as soon as possible.

Thanks

Pankaj Singh Yadav

Re: Hi ... I have a qurey. Plz Give me the solution

am 06.12.2007 07:55:20 von John Mishefske

1983.yadav@gmail.com wrote:
> I m using C#.NET and i m connected with oracle with OLEDB. I m try to
> add my user defined table in a list box from my MS-ACCESS databse.
>
> My connection string to connect with MS-ACCESS is
> "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
> txt_database_name.Text + ";"
> where txt_database_name.Text is my .mdb path.
>
> when i m excuting the query="SELECT MsysObjects.Name FROM MsysObjects
> WHERE (([Type] = 1) AND ([Name] Not Like "+MSys+*"))ORDER BY
> MsysObjects.Name"
> through cmd.excutereader, i m getting an err i.e "Record(s) cannot
> be read; no read permission on 'MsysObjects".
>
> Plz suggest me the solution, if i need to change anythng in my
> connection string, plz suggest or wht else i need to do and tell me
> how to give permission to read MsysObjects.

This system table can only be opened in "read-only" mode. Check that
your code does that.

I noticed two issues with the SQL:

1) there is no space before the "ORDER BY" clause

2) Jet uses asterisks for wild cards.

This is closer to what you need:

query = "SELECT MsysObjects.Name FROM MsysObjects" & _
" WHERE (([Type] = 1) AND ([Name] Not Like ""MSys*""))" & _
" ORDER BY MsysObjects.Name"

That's VB style code. For C# you'll have to apply the appropriate
line continuation chars (if any) and (I believe) terminate the
code line with a semi-colon. The escaped quotes too...


--
'--------------------------
' John Mishefske
' UtterAccess Editor
' 2007 Microsoft MVP
'--------------------------

Re: Hi ... I have a qurey. Plz Give me the solution

am 06.12.2007 08:51:01 von 1983.yadav

On Dec 6, 11:55 am, John Mishefske wrote:
> 1983.ya...@gmail.com wrote:
> > I m using C#.NET and i m connected with oracle with OLEDB. I m try to
> > add my user defined table in a list box from my MS-ACCESS databse.
>
> > My connection string to connect with MS-ACCESS is
> > "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
> > txt_database_name.Text + ";"
> > where txt_database_name.Text is my .mdb path.
>
> > when i m excuting the query="SELECT MsysObjects.Name FROM MsysObjects
> > WHERE (([Type] = 1) AND ([Name] Not Like "+MSys+*"))ORDER BY
> > MsysObjects.Name"
> > through cmd.excutereader, i m getting an err i.e "Record(s) cannot
> > be read; no read permission on 'MsysObjects".
>
> > Plz suggest me the solution, if i need to change anythng in my
> > connection string, plz suggest or wht else i need to do and tell me
> > how to give permission to read MsysObjects.
>
> This system table can only be opened in "read-only" mode. Check that
> your code does that.
>
> I noticed two issues with the SQL:
>
> 1) there is no space before the "ORDER BY" clause
>
> 2) Jet uses asterisks for wild cards.
>
> This is closer to what you need:
>
> query = "SELECT MsysObjects.Name FROM MsysObjects" & _
> " WHERE (([Type] = 1) AND ([Name] Not Like ""MSys*""))" & _
> " ORDER BY MsysObjects.Name"
>
> That's VB style code. For C# you'll have to apply the appropriate
> line continuation chars (if any) and (I believe) terminate the
> code line with a semi-colon. The escaped quotes too...
>
> --
> '--------------------------
> ' John Mishefske
> ' UtterAccess Editor
> ' 2007 Microsoft MVP
> '--------------------------- Hide quoted text -
>
> - Show quoted text -

Hi John....

Thanks for ur rply

I m using this code on my VB form

ms_con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=amit.mdb")
ms_con.Open()
qry = "SELECT MsysObjects.Name FROM MsysObjects WHERE
(([Type] = 1) AND ([Name] Not Like ""MSys*"")) ORDER BY
MsysObjects.Name"
Dim cmd As New OleDbCommand(qry, ms_con)
dr = cmd.ExecuteReader()
While (dr.Read())
ComboBox1.Items.Add(dr(0))
End While
But i m geeting the same error ie "Record(s) cannot
> > be read; no read permission on 'MsysObjects".

I made my mdb file read only through properties.