|
Hi all,
For creating database and table and field i must know SQL+ ?
Not any other way ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Use the Schema manger provided with the client software,
its called 'DBA Studio'.
Regards
Ray
"Je Suis Mort De Rire"
|
|
|
|
|
use the free version of toad (oracle equivalent to Enterprise Manager) from www.toadsoft.com
Top Oracle tool
|
|
|
|
|
Attempting to connect to a Sybase backend using C#, OLE and ADO.NET. Using VC#.NET I can make the data connection using OLE DB Provider for ODBC (MSDASQL) but I get a 'System.NotSupportedException' when using MSDASQL.1 as the Provider when opening a connection. MSDN help states that "Support for the OLE DB Provider for ODBC (MSDASQL) is disabled."
Does anyone have any ideas on how to circumvent this?
Thanks
|
|
|
|
|
I am trying to do the following !
Open one session of Query Analyser Window
Begin Trans
Update Table1 Set ...
But I don't commit !
Open another session of Query Analyser Window
Select from Table1
Select gets Blocked unless Update is committed !
CAN'T I DO A SELECT WHEN UPDATES/INSERTS Occur ?
I Can do with NOLOCK but we don't want uncommitted data to appear !
I have tried with all transaction isolation levels.
Anyone can help ?
Thanks
Anand
|
|
|
|
|
Hi
When i use the function CRecordSet::Update, i have an exception.
Besides, when i use the function Crecordset::MoveFirst, I don't read the first record.
Anyone can help me please.
I send you my code.
Thanks
try
{
/* APP->m_TmSet -> Open ();*/
CTmSet tmset;
if (tmset.IsOpen () ) tmset.Close () ;
tmset.Open();
MessageBox(NULL,"passe","passe3",MB_OK);
//if ( APP->m_TmSet -> CanAppend () )
if (tmset.CanAppend () )
{
MessageBox(NULL,"avant new","passe",MB_OK);
//tmset.AddNew();
tmset.MoveFirst();
tmset.Requery () ;
//tmset.Edit();
for (int n=0;n<20;n++)
{
char buf[10];
MessageBox(NULL,tmset.m_TM_NAME,"nom",MB_OK);
wsprintf(buf,"%ld",tmset.m_TM_ID);
MessageBox(NULL,buf,"id",MB_OK);
tmset.MoveNext();
}
int a=tmset.GetRecordCount();
wsprintf(buf,"%ld",a);
MessageBox(NULL,buf,"nb record",MB_OK);
/*tmset.m_BAY_CODE =TmSql->numBay ;
tmset.m_TM_ID =TmSql->numTm ;
tmset. m_TM_NAME=TmSql->libTm ;
tmset.m_TM_UNIT =TmSql->libUnit;
tmset.m_TM_ARCHIVE =TmSql->FlgArchive ;
tmset.m_TM_STATE_CURRENT =0;
tmset.m_TM_DATE_CURRENT =0 ;
tmset.m_TM_DATE_OK_CURRENT=0 ;*/
tmset.m_BAY_CODE =0 ;
tmset.m_TM_ID =0 ;
tmset. m_TM_NAME="a" ;
tmset.m_TM_UNIT ="b";
tmset.m_TM_ARCHIVE =0 ;
tmset.m_TM_STATE_CURRENT =0;
tmset.m_TM_DATE_CURRENT =0 ;
tmset.m_TM_DATE_OK_CURRENT=0 ;
if (tmset.CanUpdate () !=0)
{
MessageBox(NULL,"avant Update ","passe",MB_OK);
tmset.Update();
MessageBox(NULL,"après Update","passe",MB_OK);
}
if ( tmset.IsEOF ()!=0 )
tmset.MoveLast ();
tmset.Requery () ;
tmset.MoveLast () ;
MessageBox(NULL,"ajoute3","passe",MB_OK);
// UpdateData ( FALSE ) ;
}
else
AfxMessageBox ( "Can Not Append a Record" ) ;
}
catch( CDBException* e )
{
AfxMessageBox( e->m_nRetCode,
MB_ICONEXCLAMATION );
// Delete the incomplete recordset object
/* delete m_pSet;
m_pSet = NULL;*/
e->Delete();
}
|
|
|
|
|
You need to call AddNew or Edit Methods before you call Update. Your code currently has them commented out.
|
|
|
|
|
Hi,
I'm trying to synchronize a client side Access database with a backend SQL server database. I've combed through the MSDN and all I can find if Replication. Does anyone know if it's possible to synchronize an Access database with SQL Server?
Any help would be greatly appreciated.
Thanks,
Craig
|
|
|
|
|
Yes it is possible.
But you ave 2 choices.
Your access database is an ADP project with the MSDE engine and it's like a réplication between 2 SQL server databases.
If your access database is a Jet, your publication database must generate a character base snapshot.
Then in your Access database , you have to go in the tools menu then replication then pull subscription and follow the indications
|
|
|
|
|
This code aint working and i dont no why, anyone who can look at it an see i they find somesthing wrong.
The Procedure is:
Create procedure AdoTestA"
(@pkMbtID varchar(50))"
as
INSERT INTO MBT (pkMbtID, MbtType) Values (@pkMbtID, '122')
return
The Code:
_bstr_t bstr (L"Provider=SQLOLEDB.1; Data Source=M02WS-17-051;Initial Catalog=TEMC_MEASSQL;uid=sa");
pCon.CreateInstance(__uuidof(ADODB::Connection));
pCommand.CreateInstance(__uuidof(ADODB::Command));
Con->Open(bstr, (BSTR)NULL, (BSTR)NULL, -1);
pCommand->ActiveConnection = pCon;
pCommand->CommandText = bstrSP;
pCommand->CommandType = ADODB::adCmdStoredProc;
pCommand->Parameters->Append(pCommand->CreateParameter( L"@pkMbtID",ADODB::adVarChar, ADODB::adParamInput, 50, _variant_t("Smith")));
_variant_t vNull;
vNull.vt = VT_ERROR;
vNull.scode = DISP_E_PARAMNOTFOUND;
pCommand->Execute( &vNull, &vNull, ADODB::adCmdUnknown);
I can compile it but when execute it say abnormal program.....
MVH
Bigge
|
|
|
|
|
put some exception handling round it, atleast this way it won't crash the program
try
{
}
catch(_com_error e)
{
TRACE("Erroe %s", (LPCSTR)e.description());
}
catch(...)
{
}
also instead of using &vNull, use vtMissing variable which is define in the ado headers.
|
|
|
|
|
From now I will always use "Try and catch" even with small and simple ADO connections, i found the problem.
Thanks Rashid
This was very useful:
catch( _com_error &e){
_bstr_t bstrSource(e.Source());
_bstr_t bs = _bstr_t(" Error: ") + _bstr_t(e.Error()) + _bstr_t(" Msg: ")
+ _bstr_t(e.ErrorMessage()) + _bstr_t(" Description: ")
+ _bstr_t(e.Description());
MessageBox(0,bs,bstrSource, MB_OK);
|
|
|
|
|
Ordinarily I would create a view to solve this problem, but I'm unable to do that in this case because of parameters supplied to the WHERE clause. I have a query;
select fielda,
fieldb,
fieldc
from viewA
where date_field between Date1 and Date2
union
select fielda,
fieldb,
fieldc,
from viewB
where date_field < Date2
union ... 3 more similar select/union I need to have the resultant rows ordered in a particular sequence and so normally I would create a view, query the view and order the results of that query. In this instance, because of how the Date1 and Date2 are supplied, I can not use a view.
Is there any way to ORDER the entire resultant set of rows when you use a union of multiple queries.
Thanks.
Chris
|
|
|
|
|
Use a SubQuery.
Select Field1, Field1 From (query with Unions) Order By Field1
Cheers!!!!
Carlos Antollini.
|
|
|
|
|
Thanks for the response, Carlos. I'm using Oracle 8I and had tried to use that but continually got errors from the parser. Once I put the brace characters around the query with the unions, it worked like a champ. None of my books even gave an example such as yours. You helped me out a lot.
Thanks again.
Chris
|
|
|
|
|
Hi,
I´m connecting to a SQL Server 2000 placed on a MS Windows 2000 Server via LAN from a MS Windows 98 computer. My program (MS VC++ 6.0, ADO, OLE DB)connects OK, but eventually crashes and also adds 2 mysterious characters in different fields in the database.
If I run the program from a MS Windows 2000 computer via LAN-network everything works perfectly!
What is wrong/different with the MS Windows 98 computer???? I´ve tried almost everything - installing MDAC 2.6 RTM, DCOM98 1.3 and so on... on the MS Windows 98 computer. Nothing helps!?!
I sure hope someone is able to help me out!
Jesper Smedegaard
|
|
|
|
|
I need to be able to do the following using an SQL statement:
SELECT TOP 25 * FROM [Table] WHERE [Condition] ORDER BY [Column]
Except I want to be able to specify the start position, i.e. start n rows into the table and then extract the 25 rows I need.
I don’t know how many rows will be in the table, and there is no field that has any form of incremental value (so I can’t just say [Condition] = [Table].[Column] > n ).
The table might contain many thousands of rows, so it is unfeasible to retrieve them all then ignore the one’s I don’t want.
So, I guess my question is how can I retrieve x rows from the table, starting from row n, based on the results of my ORDER BY clause.
This must be possible, surely?
David Wulff
dwulff@battleaxesoftware.com
|
|
|
|
|
I know you can use SET ROWCOUNT to limit the number of effected rows. I'm not sure if there is anything to set the start position. Interesting question though.
|
|
|
|
|
You can not do that, sorry. (I have also needed it)
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
I had guessed as much Why oh why did the original designers of SQL not think people would need that functionality? It's common sense if you just want to retrieve, say, 20 rows from a fifty million row table, that you would rather not return the first 49,999,980 only to ignore them.
David Wulff
dwulff@battleaxesoftware.com
|
|
|
|
|
I have a SQL server and I would like to be able to write an installer to create the database for the administrator. Currently the admin has to run the query analyzer and open the .sql file that creates the database, all the tables and the login I provide and execute the query. How do you go about executing this type of query from an external program?
|
|
|
|
|
I have done this a couple of times.
Go in to the SQL Server admin, and script yopur database.
Then you get a SQL file with a lot of SQL "Queries" in. After each query there is a "GO" statement.
Just take each of those queries, without the GO part, and execute them from your installer.
There's a lot of articles here on CodeProject about how to connect to a database and execute SQL Queries.
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Hi all,
I need to access some databases. I know what ADO and ODBC can do as far as I use user defined Queries. The question is waht about stored procedures.
Can ADO or ODBC or both access them?
Thanks in Advance.
Alberto Gattegno
Software Engineer
http://www.itgil.com
|
|
|
|
|
Yes, the two tecnologis can execute Stored Procedures.
ADO has the command Execute, or Open, depending of the Stored returns Rows.
And ODBC has SQLExecuteDirect, or SQLExecute
Cheers!!!
Carlos Antollini.
|
|
|
|
|
You also have the choice of using OLE DB Consumers, the prefered way in Visual C++ when using OLE DB.
|
|
|
|
|