|
I think you're looking for the System.Data.ConnectionState enum.
Andy Gaskell, MCSD MCDBA
|
|
|
|
|
AndyG wrote:
I think you're looking for the System.Data.ConnectionState enum.
Yes,If you read all the thread you figure out that the problem is that I need an example for that.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Sure....
OleDbConnection thisIsNotRocketScience = new OleDbConnection();
if(thisIsNotRocketScience.State == System.Data.ConnectionState.Closed)
WriteTehL33tC0des();
else
WriteEv3nl33t3rC0dez();
Andy Gaskell, MCSD MCDBA
|
|
|
|
|
Thanks Andy,
AndyG wrote:
WriteTehL33tC0des();
I could not find it in MSDN,Is that somrthing in your codes?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
I have been reading up on the various ways of installing the actual database on client's SQL servers.
What methods are you using? What did you consider to be the best way?
Michael
|
|
|
|
|
You are talking about your Database or the Server?
Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Installing the database (its tables, stored procedures) onto an already existing SQL Server 2000.
Michael
|
|
|
|
|
Michael:
I always prepare a SQL Script, with the creation of the Tables, Stored Procedures, Views, Groups, minimal Users if is necessary, Permits by Group, etc....
Then I prepeare another script with the initial data if that is required.
And Ready...
I work for A Very Important Bank in the World, when I need to implement a new Application we make That, because I have no Access to Production, And those Scripts are run by the operators of the data center...
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Thats the method I'm thinking of using. I was just interested to know how everybody else does it. First time I've deployed an SQL server app since the days of SQL Server 6.5.
Michael
|
|
|
|
|
Yes is the more common method... I travel for all the world and I know that the developer use the scripts to implment the SQL Databases....
I make that from SQL Server 4.0 or 4.2 I don't remember the version..
Regards
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
hi all,
I want to using .cdb file in the PocketPC.(ADO using in the Windows CE 3.0). if anyone know please send samples me..
thanks .
MFC
|
|
|
|
|
I am working on a small application server for updating customer orders. Multiple clients (in sales department) can be connected to the server do create orders, and browse the orders.
I used conventional TCP/IP way to send data back to client. I created a ADO Recordset in my application, and pass the first 50 rows to the client, so the client can navigate the rows. However, when it beyongs the first 50, i have to do MoveNext() in the server. I doubt that my manipulation will fail in maintaining a row_no in the client where the client navigated up to. Can someone tell me a better way to handle the client side cache issue, and make it *current *position synchronized with the application server's Ado Recordset position.
By the way, I'm using VC++ 6.0 , SP5. Oracle 8i
|
|
|
|
|
When your client has 50 record the cursor can only move up to 50 rows,Your client does not any more thing to navigate in it.
Your cursor can not be in both server and client ,it is placed in one of them.(Check adUseClient and adUseServer for that.) so you can move in one of them,so what's your problem now?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Hi, I'm pretty new on this.
I created a SDI application and used database support.
When then my workspace is created I put on my CFormView derived class some edit controls and then I want to call with SQL statements my database (Acces database) so it can retreve data from column Age. There is 4 columns but thats not the problem how to write the SQL statement. The problem is HOW to call, which method??
In class Cdatabase there is a method called ExecuteSQL but I only have a CRecordset derived class in my workspace... how to use that ExecuteSQL?? or does CRecordset have a similary method???
Do you understand me?
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
This is one of my codes that read records from database and check records,if you have any problem with this code just ask
CDatabase aDB;
try
{
aDB.OpenEx(_T("DSN=test"),CDatabase::openReadOnly | CDatabase::noOdbcDialog);
CRecordset aRS(&aDB);
aRS.Open(CRecordset::forwardOnly,"SELECT *from Table1");
while(!aRS.IsEOF())
{
CString strValue;
aRS.GetFieldValue(1,strValue);
if(strValue=="Mazdak")
{
CString str;
aRS.GetFieldValue(2,str);
m_rich.SetSel(0,-1);
m_rich.ReplaceSel(str,true);
return;
}
aRS.MoveNext();
}
aRS.Close();
aDB.Close();
}
catch(CDBException *ex)
{
TCHAR buf[255];
ex->GetErrorMessage(buf,255);
CString strPrompt(buf);
AfxMessageBox(strPrompt);
}
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
This should work in a dialog based app, shouldn't it?
If yes, You're an angel!!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Rickard Andersson wrote:
This should work in a dialog based app, shouldn't it?
This will work anywhere you want not only in dialog based app.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
hm... if I want two buttons on my dialog, button 1 is gonna "send" a different SELECT to the database then button 2. Can I just close it and the open again or is it a bad way? If yes, I can't find any other solution for that.
And how can I do so that my users of my application not need to make a DSN in the Controlpanel by their own??
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Rickard Andersson wrote:
if I want two buttons on my dialog, button 1 is gonna "send" a different SELECT to the database then button 2. Can I just close it and the open again or is it a bad way? If yes, I can't find any other solution for that.
I don't understand your question copmletely.As I understand it and refer to my knowledge for an Open Connection you can have only one SELECT statement.
I myself in my application open the database in one of init functions and close it when I want to close the whole application,I think this is better than open and close each time you want to work with database.
Rickard Andersson wrote:
And how can I do so that my users of my application not need to make a DSN in the Controlpanel by their own??
That was just an example that I use ODBC driver in my copmuter,when you use Access database you can just give the path of that file to it.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Mazdak wrote:
I don't understand your question copmletely.As I understand it and refer to my knowledge for an Open Connection you can have only one SELECT statement.
Yes, and if I want to get data from only one column in the database's table AFTER the Open(...) call. How can I do then? Do you understand?
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Rickard Andersson wrote:
Do you understand?
Yes
Rickard Andersson wrote:
Yes, and if I want to get data from only one column in the database's table AFTER the Open(...) call.
First:If you want to work with only specific columns in database in your SELECT statement you can specify them.(I think you know this one;) ).
Second:You choose some columns in your SELECT statement,but now you want a data from one of these columns,you have to use GetFieldValue() ,in the first parameter of it you choose the index of that COLUMN,but before that you have to locate of cursor to your proper ROW with Move() method.The second parameter of GetFieldValue() receive the data in the field that you locate cursor before.It is not important how many column you choose in SELECT statement,with GetFieldVlue() you work with each one you want.So you don't need new SELECT statement.
Have you got the point now?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
one option is:
1) Create an instance of the CDatabase object, this object represents a connection to the Database (See method Open to set the Connection String)
2) Instanciate your Recordset with the CDatabase object already Constructed
3) Call Open on the Recordset using the corresponding SQL Statement.
Hope that helps.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
Andres Manggini wrote:
1) Create an instance of the CDatabase object, this object represents a connection to the Database (See method Open to set the Connection String)
2) Instanciate your Recordset with the CDatabase object already Constructed
3) Call Open on the Recordset using the corresponding SQL Statement.
And then I call another method to get the data?
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Mazdak has post a very clear sample here (as a response to your message)
http://www.codeproject.com/script/comments/forums.asp?forumid=1725&select=135665&tid=135655#xx135665xx
you can see right there how to create the database, create the recordset, open it, and get data out of it.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
Rickard Andersson wrote:
And then I call another method to get the data?
With GetFieldValue() you can get the specific column value in a specific ROW,to move in the rows you can use Move(),MoveNext(),MovePrev() and ....
Hope thats help.Any other question?
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|