|
Can NHibernate call stored procedure? I read NHibernate reference doc, doesn't look like it's there, am I right about this?
Norman Fung (c)
|
|
|
|
|
hi,
I am using
VisualStudio2003,
Access2003
Vb.Net and ADO.Net for db access.
I get this message when i try to use ExecuteReader method :
IErrorInfo: GetDescription failed with E_FAIL( some hexvalue )
Now i tried MSDN it says GetDescription supposed to return description of error that is generated by database.
This is what I am doing:
I have a table called section
g_AdoCon = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" + db)
//checked the db variable, it is valid path and everything and this
// conenction works in another class fine
If g_AdoCon.State = ConnectionState.Closed Then
g_AdoCon.Open()
End If
m_Command = New OleDbCommand
m_Command.Connection = g_AdoCon
query = "Select * from section where cls_id = 3"
m_Command.CommandText = Query
m_Reader = m_Command.ExecuteReader(CommandBehavior.CloseConnection)
the exception is raised when m_Command.ExecuteReader is executed.
Am really stuck on this, sionce MSDN didn't really help and i have no idea what that exception means.
Pleas help!

|
|
|
|
|
So what was the hex value -- have you tried to look it up in the KB?
How and where is m_reader declared?
Have you tried putting a try -catch around the ExecuteReader and printing the error description in the catch block?
dumping the stack trace?
It would appear that you have only provided selected parts of your code...
maybe a cut/paste of the whole thing would shed some light.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
"So what was the hex value -- have you tried to look it up in the KB"
0x80004005 - E_FAIL. Microsoft says underlying component did not had a specific error number for encountered error. It happens for a lot of things but nothing specific for ADO. jsut means a general failure. How ever i found a similar problem on net on this query.
"Select * from mytable where language = 'EN'"
The problem got solved when authormodified the query to
"select * from mytable where [LANGUAGE] = 'EN'"
apparently ado treated language as keyword.( thatw as the cause given ). But this dosn't work in my case and am totally lost.
Rob Graham wrote:
Have you tried putting a try -catch around the ExecuteReader and printing the error description in the catch block?
dumping the stack trace?
AI got the error message by using the try catch, so answer is yes. dumping the stack trace????dunno what u mean here.
Rob Graham wrote:
How and where is m_reader declared?
m_reader is decalred a private member of the class in which all this is happening as
Private m_Reader As OleDbDataReader
Rob Graham wrote:
It would appear that you have only provided selected parts of your code...
maybe a cut/paste of the whole thing would shed some light.
cut paste whole class??? well it never gets past this point so i dunno if pasting the rest of code is nay use at all, cuz it has nothing to do with this.
Randhawa
|
|
|
|
|
since the reader is a private member, rather than a local variable, I presume you are reusing it in other functions. Did you remember to close the reader each time you were through with it (closing the connection might not be enough)? As a general rule, I create datareaders as local variables, rather than members, and close them after each use.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
yeah it's getting closed after am done with it, every time.
Actually it has never reached to the closing point yet, since the executereader never got executed since i wrote it.
|
|
|
|
|
is the datareader null, after the execute attempt?
You don't close it in a finally block to insure it is closed even if an exception is thrown? (the fact that it thew an exception doesn't necessarily mean that it is properly closed...)
Have you tried creating the reader as a local variable inside the function?
I'n not sure why you chect the connection state to see if it is closed before trying to open it, since you just created it with a New...hve you single stepped the code to see if the connection really gets opened?
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
Well first of all it's very common to use ACCESS keywords as fields or tables names and cause the ACCESS to do something strange!!!
Try "SELECT * FROM [Section] WHERE [cls_id]=3" instead.
Second,Why are you using CommandBehavior.CloseConnection?
if you want to close your connection you can do it using connection object itself(I'm not familiar with CommandBehavior but I prefer to do one job at a time first create the reader then close the connection)
|
|
|
|
|
The problem was with the Query. Section seemed to have problems, and putting it in [ ] brackets didn't help either. I changed the name of the table to Sections and everything is working fine.
Thanks for all you guys help
|
|
|
|
|
Hi, I’m trying to find something about object/relation using xml, a design patterns or good strategies.
This must be quite common, but its still hard to find information about this area.
|
|
|
|
|
I think you should be looking for DiffGrams in DataSets.
Live Life King Size
Alomgir Miah
|
|
|
|
|
Hi,
I need to know if you are able to access an Access database across networks? I have my ASP code at one hosting company in the states, and the Access database is at another hosting company in South Africa. They are not on the same networks.
A colloeague of mine says this is not possible because Access is a file driven database.
Any help will be appreciated!!
Thanks.
|
|
|
|
|
Brendan Vogt wrote:
I need to know if you are able to access an Access database across networks?
??? what do i hear ? Access DataBase ?
what a good joke !!
no, seriously, access, is not a database as SQL server, Oracle, mySQL, are...
consider seriously revising your need of using such software...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
You might be able to use a UNC file path to the database (this works on a local lan, provided the user has access to the directory). It will be slow however, and is not likely to prove satisfactory (performance wise), if it works at all.
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
In vs.net 2005, I want to connect with MySQL database.
After trying some hours, I found there is many questions:
1 Add reference error.
Which dll should be add into project?
2 Connect String error.
Which provider in OLEDB could be used?
3 User name and password and datasource.
Thanks!
|
|
|
|
|
OLE DB Provider for mySQL
oConn.Open "Provider=MySQLProv;" & _
"Data Source=mySQLDB;" & _
"User Id=myUsername;" & _
"Password=myPassword"
|
|
|
|
|
I use the provider "MySQLProv",but the .net 2005 beta2 said "the provider is not registered on the local machine.
|
|
|
|
|
|
Hi fellows
I've a problem with SQL Server 2000. When I enter in the Enterprise manager, I receive the following message:
"Failure on snap-in initilization
Name: <unknown>
CLSID:{0001000100-1816-11D0-8EF5-00AA0062C58F}"
Some can help me?
Regards
|
|
|
|
|
hi
i m new to the ADO i want to know that is ADO had the ability to read and write athe dbase IV database using visualc++.
ddd
|
|
|
|
|
Hey,
I am trying to teach myself SQL and have come up with a small problem. How does one use SQL to list the names of all the tables in a database? Up until now I have done it using Carlos Antollini's CADOXCatalog class[^] but I want to do it in SQL from Query Analyzer.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
try:
select Name, Type from sysobjects where Type = N'U' or Type = N'S'
Type 'U' is a user table , type 'S' is a system table
Absolute faith corrupts as absolutely as absolute power
Eric Hoffer
All that is necessary for the triumph of evil is that good men do nothing.
Edmund Burke
|
|
|
|
|
Thanks Rob, works like a charm
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE'
|
|
|
|
|
Thanks, works great.
Not only does it work, but when I looked this method up in my SQL book it says that this is the prefered way to do this. Better to use a system view than to access system tables directly.
Now I know how to do this (and other things) with SQL Server, it would be nice to have a way that works with other Database systems (MySQL and Access in particular. None of the three methods listed here work with those two systems
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|