|
So clear - so succinct that I wonder why I didn't think of it myself.
Thanks...
"When you have made evil the means of survival, do not expect men to remain good. Do not expect them to stay moral and lose their lives for the purpose of becoming the fodder of the immoral. Do not expect them to produce, when production is punished and looting rewarded. Do not ask, `Who is destroying the world?' You are."
-Atlas Shrugged, Ayn Rand
|
|
|
|
|
RIGHT! Now give the guy a 5-vote. Voting helps identify the really valuable posters.
|
|
|
|
|
Hello
I have a problem with using ADO in Visual C++. I'm need to get tables names of database by using types from ADO type library. I found one method:
_RecordsetPtr rs_table_names = ado_conn->Execute(L"SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES", NULL, -1L);
But there is a problem. This method allows me to get tables names only of SQL server, but with other database formats (MS Access, TXT files, Excel) it doesn’t work.
Thanks in advance.
|
|
|
|
|
It looks like that Jet provider doesn't provide access to INFORMATION_SCHEMA. I found discussion about such problems. May be it'll help you.
|
|
|
|
|
2Ilya: Thank you for link (Спасибо за ссылочку!).
I nave another question: how can I get field data format string.
When I used DAO, I got this string by DAOProperty::GetValue call.
For example, this string looks like "General Number","General Date","Long Date" or something like "#,##0.00."p.";=#,##0.00"p."".
|
|
|
|
|
Hi,
I have a long SQL querie and my TL has asked that I concatenate them so I am not repeating the same querie over and over again. The thing is, each querie is inside a new for loop so if I concatenate, it is not picking up the previous query. For example this is what I had before for each for loop except that the end where clause is different for each.
<br />
for bla bla<br />
{<br />
ring sql = "select e.Firstname,e.Lastname,r.Role,r.Description,d.DivisionName,a.Applications,m.ManagerFirstname,m.ManagerLastname,t.ProgLanguagesDatabase" +<br />
" from employees e,Division d,Manager m,TechnicalSkills t,Role r,Applications a where " +<br />
" e.ManagerID = m.ManagerID<br />
My TL wants me to write
for {
sql1 = blabla
}
for bla
{
sql2 = sql1 + (Sql query)
}
Obviously it is telling me that sql2 does not exist. At the moment I have something like this after the queries.
SqlDataAdapter myCommand = new SqlDataAdapter(sql, myConnection);
and obviously I can't overload this each time with sql2, sql3 etc)???
Sianny aka Sharny
|
|
|
|
|
Realistically, you should not be building SQL this way anyhow, you should be calling stored procs, from a data layer.
I'm not sure I follow, you will have multiple queries in one call ? then your string needs to be defined outside the first loop, so you can add to it.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
if I declare them outside the loops
string sql1;
string sql2;
string sql3;
etc
then inside each for loop I have a sql query like
for ()
{
sql2 = sql1 + "where bla bla";
}
for()
{
sql3 = sql1 +"where bla bla";
}
Obviously sql1 and 2 and 3 etc are never assigned as they are defined outside the loops and it never picks up their value?
This is what the error is telling me anyway.
Thanks
|
|
|
|
|
ah...i think I worked it out now. I'm not sure if that is what you were trying to tell me anyway, but I have declared the common query outside all the loops like this
string sql = "Select e.Firstname,e.Lastname,r.Role,r.Description,d.DivisionName,a.Applications,m.ManagerFirstname,m.ManagerLastname,t.ProgLanguagesDatabase" +
" from employees e,Role r,Division d, Manager m, TechnicalSkills t,Applications";
then later i have used sql2 = sql + "where etc";
Is this the correct way?
thanks
Sharny
|
|
|
|
|
I expect each loop would end up adding a query to the main sql string, but, it's hard to say, I'm not entirely sure why you're putting strings in from more than one loop, or what the end product is to be. But yes, having one string to hold all the SQl was my suggestion.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Thankyou. I need to have nested loops because I've got multiple user search options on a windows form. I have it working baced on what I said. I just had to do a bit more trial and error and I would've worked it out without asking.
Thank you
|
|
|
|
|
Hi.
How can I backup from DB (SQL Server) in code ?
Or using sql statements?
Best wishes
|
|
|
|
|
I think you can use stored procedures to create backups of the database. I don't remember what it is called.
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Hi, all.
Is there any solution to intercept SQL statement on client workstation, stop it temporary, make some edit operations with WHERE clause, and send an upadated SQL to server?
Can i make it using C++? I've never met this task yet, so, could you tell me, where a have to dig (documentation, links, e.t.c). I'm interested in Oracle and SQL Server solutions. Maybe there is ready example?
Thanks a lot.
|
|
|
|
|
LinCorJDE wrote: Is there any solution to intercept SQL statement on client workstation, stop it temporary, make some edit operations with WHERE clause, and send an upadated SQL to server?
I think it would be better if you told us the bigger picture because I can't imagine this would be a very good solution to anything other than an attack on the database.
|
|
|
|
|
OK, try to do it.
So, we have ERP system "Oracle JDEdwards Enterprise One".(Who knows about this system - they understand me ) It generates SQL statement using visual tools:
link tables using "drag and drop", create WHERE statement using "mouse" method, not manual writing. I can add own WHERE's using only visual components. And there is no GROUP BY (!), i can not use any hints, and using SELECT in WHERE statement is impossible. All i need is to edit WHERE statement in system generated SQL.
|
|
|
|
|
|
|
Please don't cross post and please don't put Urgent in the title.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
|
Cheers.;)
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
You say "dont" he says "will do" and you say "cheers"?? Fun language this...
|
|
|
|
|
I have a table, that has an Identity Column as a Primary key.Suddenly there are some Dublicate that have same idenitity Column ID, and they look identical. i cant remove the Duplicates because they have the same ID. please help me to remove the Duplicate.
thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
Hmmm. Did you remove the unique constraint from your primary key field by any chance (the identity column is a primary key, isn't it)? This constraint is there to ensure that you can't have duplicate fields.
Anyway, there are a number of ways that you could do this, but the implementation really depends on factors such as do you have foreign keys linked to your table? If so, then you really need to be careful about deleting.
A quick thought has occurred to me - how did you select these records? Are they part of a multi-table select? If so, it is likely that what you are seeing is the result of a one-to-many relationship. Try selecting the data out of the table on its own.
If a single table select still produces duplicate data and it's not a part of a foreign key then you can do the following:
Open up your table in the designer and drop the identity column. Save it to the database. Then add the identity column back into the table and save it again. The stages here drop the identity column and then force the database to apply a new identity column - which will have the effect of giving a new Id to each record. Voila - you now have unique rows.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi
Thanks for your reply
i did not remove the primary key Constraint. And there is a Foreign key linked to this table.
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sudden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|