|
Looks like you have not added the reference to System.Data.OracleClient.dll. Check it out
Bhaskara
|
|
|
|
|
Yep, that was the problem. Just had to right-click "references" in the project window, and say "Add"!
-Thomas
|
|
|
|
|
Hi,
I'm in a situation where my VB.NET code will know the name of a database, and can connect to it, but needs to get the mdf and ldf file names for that database. Is there a property of some ADO.NET object that will tell me the file names? Or maybe a query to run to get the file names?
Thanks
David
|
|
|
|
|
In the master database there is a system table called sysdatabases which gives the full path to the primary file of each database. In each database itself there are two system tables that would be useful to you the first is sysfilegroups which joins to sysfiles . It is sysfiles that actually contains the list of files for the database.
If you need more information the SQL Server books on-line should fill in all the details you need.
Does this help?
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
That's exactly what I needed, thanks!
David
|
|
|
|
|
is there some way to convert a access database to a mysql ? I am not interested in expensive tools , as i can not pay for this .
|
|
|
|
|
The only technical thing I know about Access is that it never should have been written. Even MSDE is better than Access! To be safe, I'd export the Access database as a CSV file, manually create your schema inside MySql, and then tell MySql to import the CSV file. It's a little more work then a fancy point & click tool, but you know your data will go through perfectly.
-Thomas
|
|
|
|
|
Hi,
Take a look at this: http://solutions.mysql.com/software/?item=98[^]. It's from the MySQL website. Although the tool is shareware, you might be able to convert with the demo version. I haven't looked so I'm not sure if they disable it in the demo version.
In any case, there are tools, so if that doesn't work, you can look elsewhere on the MySQL website or on Google.
Sincerely,
Alexander Wiseman
Est melior esse quam videri
It is better to be than to seem
|
|
|
|
|
Consider the following:
Database name - junkDB
Table name - junk
Fields - 1) slno char(10)
2) name char(20)
3) message char(200)
4) date_time datetime
the 4th field is of type datetime. (eg: 07/20/2004 5:30:45 PM)
i am connecting to the database using VC++ (SDK), using the #import (msado15.dll) statement.
when i retrieve the date_time field, i get a floating point value (somewhat like this 37842.4578131)
can someone help me with this. how can i retrieve the datetime field properly.
thankyou,
Deep George Zachariah
|
|
|
|
|
deep_george_zach wrote:
i get a floating point value (somewhat like this 37842.4578131)
Possibly the number of days since 1/1/1901
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
The Second EuroCPian Event will be in Brussels on the 4th of September
Can't manage to P/Invoke that Win32 API in .NET? Why not do interop the wiki way!
|
|
|
|
|
is there any way to get the datetime directly....
if no, then how do i convert the floating point number into date...
any idea ??
thankyou
Deep George
|
|
|
|
|
Use the Format() method to format it in whatever way you want. Like Format("%Y-%m-%d") formats it to Year, Month and Day format. Format method is member of CTime class.
|
|
|
|
|
Hi there,
I have generated some SQL script-files using the SQL-Enterprise Manager (for
creation of tables, stored procedures, etc.).
When running those script files through the isql or osql utility, I have the
possibility to capture the output to a file, which is sort of importand to
me.
What I'd like to do is to write a small utility (Windows app in c#) which
will execute my sql-script-files on the SQL server. Again, I need to capture
the output. Can this be done using an SqlCommand-object providing the
contents of each individual script-file as the command text or do I have to
use isql. In both ways I'd like to know how it is possible to capture the
output.
The output is actually only required if there have been errors during
batch-execution.
Any help is greatly appreceated. Thanks in advance.
Matthias
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)
www.emvoid.de
|
|
|
|
|
isql has output parameter : /o
public int Exec( string sCommand )
{
int nResult = 0;
m_oInstallProcess = new Process();
m_oInstallProcessInfo = new ProcessStartInfo("cmd");
m_oInstallProcessInfo.UseShellExecute = false;
m_oInstallProcessInfo.RedirectStandardInput = true;
m_oInstallProcessInfo.RedirectStandardOutput = true;
m_oInstallProcessInfo.RedirectStandardError = true;
m_oInstallProcessInfo.CreateNoWindow = true;
m_oInstallProcess.StartInfo = m_oInstallProcessInfo;
m_oInstallProcess.Start();
m_oCommandWriter = m_oInstallProcess.StandardInput;
m_oResultReader = m_oInstallProcess.StandardOutput;
m_oErrorReader = m_oInstallProcess.StandardError;
m_oCommandWriter.AutoFlush = true;
m_oCommandWriter.WriteLine( sCommand );
m_oCommandWriter.Close();
m_oCommandWriter = null;
string s = m_oResultReader.ReadToEnd();
m_sErrorMsg = m_oErrorReader.ReadToEnd();
if( s.IndexOf("Cannot open input file") > 0 )
throw new Exception( "Command:\r\n"+sCommand+"\r\nError:\r\nCannot open input file!" );
else if( m_sErrorMsg.Trim().Length > 0 )
throw new Exception( "Command:\r\n"+sCommand+"\r\nError:\r\n"+m_sErrorMsg+"" );
else
System.Threading.Thread.Sleep( 10 );
return nResult ;
}
D!shan
|
|
|
|
|
Hi D!shan,
thanks for your reply! Your example, which I find extremely interesting is unfortunately not, what I was looking for, because it assumes, that the person running my tool is required to have osql installed on his/her machine.
So I was actually looking for a way to do this through an SqlCommand object. What I've done now is that I've written a parser for SQL script files, which creates a queue of individual commands which can actually be executed through the SqlCommand. Now I'm looking for a way to hook up the output from Sql-Server when doing ExecuteNonQuery()...
Regardless of that, I find your code very useful for many other situations. Be sure of a good rating and thanks a lot.
Matthias
If eell I ,nust draw to your atenttion to het fakt that I can splel perfrectly well - i;ts my typeying that sukcs.
(Lounge/David Wulff)
www.emvoid.de
|
|
|
|
|
Hi!
I'm being plagued by the dreaded Jet error 3218 "Couldn't update; Currently locked" from time to time.
My application is a windows service that instatiates a server object that's being published for remoting using RemotingServices.Marshal(myObj, myURL) .
This server object receives requests from remoting clients and reads and writes to an Access 2000 database using OleDb. In addition, the server object performs some actions at the tick of a System.Timers.Timer, reading and writing to the DB as well.
Now sometimes I get this error 3218, even when there are just 1 or 2 clients connected and I can't explain why this is happening.
I'm not using any transactions, so I can't see why any recordset should be locked for a longer period of time.
I also Dispose() of all OleDbConnections as soon as the query is through, thus accumulation of open DB connections shouldn't be an issue either.
Does anyone have an explanation or, even better, a clue on how to avoid this error?
TIA,
mav
|
|
|
|
|
|
Thank you Anders for your reply!
I'm closing all connections already. In fact I only closed the connections in the beginning without disposing and then read somewhere that this might be the reason. So I disposed of all connections after closing them, but to no avail.
I know it might sound silly, but just to make sure I'm not misinterpreting the whole situation, can somebody confirm this:
1) Several threads are accessing the database, so there's the possibility that two or more queries are started simultaneously.
2) I set the locking mode to row level locking in the connect string, so a collision should ONLY be possible when two threads try to access the same row in the same table and at least one of them is writing.
3) When such a collision occurs the DB retries for the number of times specified in the access db (I set it to 10), waiting for the period specified (250ms) every time.
4) So the writing update is taking > 2,5 seconds to complete and at the same time there's a reading access to the same row?
If these assumptions of mine are correct, then reducing the tries/interval should increase the probability of getting a 3218, right?
mav
|
|
|
|
|
Hi
I have a table CandidateTab Which contain the CandidateId and Skill fields and data in this table are in following format.
CandidateID Skill
---------------------------
10 VB.net
10 ASP.net
10 C#
11 Oracle
11 SQL SERVER
How can I make a query to get result in following format
CandidateID Skill
10 VB.net,ASP.net,C#
11 Oracle,SQL SERVER
Thanks
Arvind
|
|
|
|
|
Is not easy to get the result in one simple query! . At least you must write a cursor to doing this..
D!shan
|
|
|
|
|
Try this also.. its little bit matching to ur prob.. OR is it ok to doing this through cursors?
USE pubs
GO
DECLARE @title_ids varchar(150), @delimiter char
SET @delimiter = ','
SELECT @title_ids = COALESCE(@title_ids + @delimiter, '') + title_id FROM titles
SELECT @title_ids AS [List of Title IDs]
D!shan
|
|
|
|
|
THANKS,I will try it
Arvind
Arvind
|
|
|
|
|
Im trying to do the following query on a view in access db:
"SELECT List Totals.Expr1,List Totals.Order ID FROM List Totals"
this is the view definition that i got from the db:
"SELECT Sum([Orders Detail].[Unit Price]*[Orders Detail].[Quantity]) AS Expr1, Orders.[Order ID]\r\nFROM Orders INNER JOIN [Orders Detail] ON Orders.[Order ID] = [Orders Detail].[Order ID]\r\nGROUP BY Orders.[Order ID];\r\n"
and i get syntax error missing operator in query expression List Totals.Expr1
how do i do this right?
|
|
|
|
|
|
Thanks ,this is a step forward , what does the square
brackets mean?
|
|
|
|