|
I have always found it much easier to implement my own methods for populating, paging and editing in the DataGridView using POCO classes filled by using ADO than using DataSets to be honest.
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
hi,
i am inserting values in such format:
first add column than insert its value,than add second column but here the ALTER TABLE gives error after INSERT INTO in same table.
please help me how can i do this.
thanks.
|
|
|
|
|
|
CDatabase database;
CString sDriver = "MICROSOFT EXCEL DRIVER (*.XLS)";
CString sExcelFile =_T("C:\\Users\\Admin\\Desktop\\1.xls");
CString Query_Str="";
TRY
{
Query_Str.Format(_T("DRIVER={%s};DSN='';FIRSTROWHASNAMES=1;READONLY=FALSE;CREATE_DB=\"%s\";DBQ=%s"),
sDriver, sExcelFile, sExcelFile);
if( database.OpenEx(Query_Str,CDatabase::noOdbcDialog) )
{
Query_Str = "CREATE TABLE demo (Name TEXT)";
database.ExecuteSQL(Query_Str);
Query_Str = "INSERT INTO demo (Name) VALUES ('Albert')";
database.ExecuteSQL(Query_Str);
Query_Str = "ALTER TABLE demo ADD Col2 TEXT";
database.ExecuteSQL(Query_Str);
}
database.Close();
}
CATCH_ALL(e)
{
AfxMessageBox(e->ReportError());
}
END_CATCH_ALL;
can u please help me to ALTER TABLE with DEFAULT
modified 15-Nov-11 2:31am.
|
|
|
|
|
First add all the columns and do the insert when all columns are present, or make sure that the column you're going to add accepts null-values.
Bastard Programmer from Hell
|
|
|
|
|
Eddy Vluggen wrote: First add all the columns and do the insert when all columns are present, or
make sure that the column you're going to add accepts null-values.
its not sure how many column are in current sheet,so how can i do this?
how can add column to accept null values.
is there no any method to add column after inserting row in table.
|
|
|
|
|
You will probably have to commit the data to the database before continueing to change the table structure. Not all database drivers / databases like it when you modify a table and add data to that same table within the same transaction. (I know that this could cause table corruption in ms access for example.)
|
|
|
|
|
please give any solution or help for this.
|
|
|
|
|
hi all,
i am using CDatabase to open the database and its function ExecuteSQL to execute the query.
here how can i get all column name list of current database.
please help me for this.
thanks in advance.
|
|
|
|
|
Le@rner wrote: get all column name list of current database.
Did you mean get all column name list of current table.
I Love T-SQL
"VB.NET is developed with C#.NET"
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
Blue_Boy wrote: Did you mean get all column name list of current table.
yes
|
|
|
|
|
Hmm CDatabase looks like a wrapper class around a connection - a C++ one at that!
It will depend on your database and your permissions but in sql server there are the system information views and the sysobjects table. These will supply all the system information you need. This may be useful System view mapping[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
Why I am getting the following error for Functions?
1548 cannot load from mysql.proc. The table is probably corrupted
Thanks,
jassim
|
|
|
|
|
|
I did that and I restarted the server to make sure the services were restarted but I am still facing the same problem.
|
|
|
|
|
DECLARE
cursor c1 is select * from dept;
cursor c2 is select * from emp;
s emp.sal % type;
BEGIN
for i in c1
s:=0;
dbms_output.put_line(‘
dbms_output.put_line(‘Department is:’║ i.deptno║’Department name is:’║i.dname);
dbms_output.put_line(‘
for j in c2
if(i.deptno=j.deptno)then
s:=s+j.sal;
dbms_output.put_line(j.empno║ ‘ ‘║j.ename ║’ ‘║j.sal);
end if;
end loop;
dbms_output.put_line(‘
dbms_output.put_line (‘Total salary is:’║s);
dbms_output.put_line(‘
end loop;
END;
Please help i need solution ASAP ty
|
|
|
|
|
Well, what's the problem?
|
|
|
|
|
This is the error
ERROR at line 7:
ORA-06550: line 7, column 7:
PLS-00103: Encountered the symbol "S" when expecting one of the following:
. ( * @ % & - + / at loop mod remainder rem ..
<an exponent (**)> || multiset
The symbol "loop" was substituted for "S" to continue.
ORA-06550: line 8, column 27:
PLS-00103: Encountered the symbol "`" when expecting one of the following:
( ) - + case mod new not null <an identifier>
<a double-quoted delimited-identifier> <a bind variable>
table continue avg count current exists max min pr
ORA-06550: line 9, column 24:
PLS-00103: Encountered the symbol "`" when expecting one of the following:
( ) - + case mod new not null select <an identifier>
<a double-quoted delimited-identifier> <a bind variable>
table continue avg count current exists max
|
|
|
|
|
I have no idea what language that is, but perhaps you shouldn't be using the ` character. As for S on line 7, you're on your own.
|
|
|
|
|
It looks like PL-SQL to me.
|
|
|
|
|
Yes, but embedded in something Pascal-like? I haven't done PRO*C for more than ten years.
|
|
|
|
|
Well, that's PL/SQL, it's meant to look like ADA or Pascal.
PL/SQL != Pro*C
|
|
|
|
|
|
It looks like you're missing the keyword loop after for i in c1 and after for j in c2
Try this:
DECLARE
cursor c1 is select * from dept;
cursor c2 is select * from emp;
s emp.sal % type;
BEGIN
for i in c1
loop
s:=0;
dbms_output.put_line(‘
dbms_output.put_line(‘Department is:’║ i.deptno║’Department name is:’║i.dname);
dbms_output.put_line(‘
for j in c2
loop
if(i.deptno=j.deptno)then
s:=s+j.sal;
dbms_output.put_line(j.empno║ ‘ ‘║j.ename ║’ ‘║j.sal);
end if;
end loop;
dbms_output.put_line(‘
dbms_output.put_line (‘Total salary is:’║s);
dbms_output.put_line(‘
end loop;
END;
/
|
|
|
|
|
I have got a problem with modifing the tables of MDF because the LDF file cannot make a corresponding changes.
I used SQL2000 manager to ouput a table of mydata(game database) to a xls file. Then I used Excel to make changes to it, since Excel is easy to manage a great number of entries. After having finished that, I converted xls file back to the table in mydata. Something went wrong, cuz I hadn't update the corresponding LDF file.
Could someone give a solution? many thanks.
|
|
|
|