|
thanks
when i convert the field type from varchar to nvarchar the problem fixed.
|
|
|
|
|
Keep in mind that it also doubles the size (in bytes) of the field!
|
|
|
|
|
The stumper of the week for me is determining how to link together the DataGridView, BindingSource, TableAdapter, and DataSet in order to make the data entered by the operator flow into the actual SQL Server database. I've spent a week searching for an example without hitting pay dirt. Can someone point me to a decent tutorial on the subject?
Will Rogers never met me.
|
|
|
|
|
|
Both look like excellent articles - Thanks!
Will Rogers never met me.
|
|
|
|
|
Might I suggest you forego the tutorials on DataSets and Table Adapters and concentrate on learning ADO.Net right from the start. It would serve you much better in the long run, particularly if you want to start implementing n-Tier design and OOP, and maybe go on to WPF. There are lots of good tutorials out there, here are a few:-
Using ADO.NET for beginners[^].
Overview of ADO.Net[^]
The C# Station ADO.NET Tutorial[^].
Anyway that is just my 2 cents.
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
I've been using ADO.Net, but never tried using a DataGridView, and it seems to be made to utilize the mucky triumvirate of DataSet, TableAdapter, and BindingSource if one can believe the documentation. I just thought it would be nice for once to try what Microsoft intends, rather than going my own way as I usually do.
Will Rogers never met me.
|
|
|
|
|
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
|
|
|
|