|
Thanks. That helps.... I didn't want to make fields too short nor too big;)
$TeVe McLeNiThAn
|
|
|
|
|
Cheers, glad to help
Bruce Duncan, CP#9088, CPUA 0xA1EE, Sonork 100.10030 Blackadder: Baldrick, have you no idea what irony is? Baldrick: Yeah, it's like goldy and bronzy only it's made of iron.
|
|
|
|
|
I have a situation whereby I need to modify a base query with an unknown number of additional restraints which are themselves held in a reference table. How would I go about this?
For example the reference table might hold:
"user_name <> 'default'"
"policy_no > 20000"
etc.
and my stored proc needs to add these conditions to its select operation. Ideas?
'--8<------------------------
Ex. Datis:
Duncan Jones
http://www.merrioncomputing.com
|
|
|
|
|
I'm assuming you're using SQL Server.
Look up the sp_executesql system stored proc or the EXECUTE ( ) statement, both will let you execute a statement contained within a varchar variable.
Bruce Duncan, CP#9088, CPUA 0xA1EE, Sonork 100.10030 Blackadder: Baldrick, have you no idea what irony is? Baldrick: Yeah, it's like goldy and bronzy only it's made of iron.
|
|
|
|
|
I'm using Sybase XI - but I'm sure there's an equivalent somewhere - but that'd mean I'd have to assemple the entire query as a varchar().
'--8<------------------------
Ex. Datis:
Duncan Jones
http://www.merrioncomputing.com
|
|
|
|
|
Sorry, don't know anything about Sybase, but I would imagine it has something similar.
Maybe this is what you're looking for ?
How can I execute dynamic SQL with ASE?[^]
Bruce Duncan, CP#9088, CPUA 0xA1EE, Sonork 100.10030 Blackadder: Baldrick, have you no idea what irony is? Baldrick: Yeah, it's like goldy and bronzy only it's made of iron.
|
|
|
|
|
Okay... c# winforms ado.net
Can i size up columns using the resource editor thing?
Ahead of time before the app starts and forces the user
to resize all the columns each time?
And how do I hide a column?
Thanks.
...Steve
|
|
|
|
|
Dear friends,
I have an application developed in VC++ and it makes an active connection to SQL server using ADO. My application issues queries and in return SQL server sends me results.
Is it possible that SQL server 'talk to my application' i.e what i want is that whenever any row of a table is changed in SQL server by some other entity, SQL server inform my application of this change. Is it possible??
|
|
|
|
|
Hi..
Seems you need to create a trigger in SQL Server that call an Extended Stored Procedure (made in vc++ for example)
this Stored Procedure can store a shared variable that your Application checks for it..
You can create a worker thread that is blocked until this variable changes and unlocked by the Extended Stored Procedure...
Anyway .. I love the idea of making SQL server talks to your Application..
tell us about any progress
|
|
|
|
|
I'm new to c#, winforms and ado.net, so bear with me.
I've got a dumb lil checkbook table. I don't WANT to have an identity
column for a primary key, but i do to help out ado.net...
So I get SqlConnection, DataSet, and SqlDataAdapter's Fill/Update.
I haven't really messed much with the DataGrid, but got somethin goin on.
And I need help with the properties of this frassin brassin adapter.
I've been thru the adapter wizard, but hate the mess it leaves.
I know about the commandbuilder a bit, but don't know when it's needed
and when not.
1) c# to hide the dang identity column in my datagrid is?
2) can I lose the identity column? implications are?
3) What's the deal with the SqlDataAdapter properties???
I guess tackin on a CommandBuilder is easiest, but you gotta have
a single primary key, right?
Otherwise, what do I do to fill in the sel/ins/upd/del command props?
Thanks VERY much for ANY help
...Steve
|
|
|
|
|
Hi folks,
From a dataset (generated by Data.SqlClient rather than Data.OleDb) can I determine the original SQL Datatype? I am trying to determine if a field is Currency vs. a straight decimal. It seems that the "datatype" property of the datacolumn object return decimal for both SQl currency and SQL decimal.
Thanks
Tom K.
|
|
|
|
|
Hi, all,
I am very close to finish my first .NET application( C#, Winform Datagrid, and MS Access database). I can modify all the data in my DataSet on my winform datagrid. NowI am trying for the first time to save the data back to my Access DB. When I call daMyDataAdaptor.Update( for a single table), I got this attached error. It says the UPDATE statement has syntax error, but the Statement was created by the wizard when I configured DataAdaptor, how can it be wrong? I know this must be something I missed, Please help.
Due to size limitation of the attachment, I can not attach the small test program. If you can help me, I can sent you the zip test program.
Code on Save button as follows:
------------------------------------
if ( connMain.State != ConnectionState.Open )
{
connMain.Open();
}
System.Data.OleDb.OleDbTransaction trans = connMain.BeginTransaction();
daTaskList.UpdateCommand.Transaction = trans;
try
{
daTaskList.Update(dsMain1, "LMTaskList");
//System.Exception MyErr = new System.Exception("Error Occurred");
//throw(MyErr);
trans.Commit();
}
catch(System.Exception err)
{
trans.Rollback();
MessageBox.Show("Failed to save Available Tasks!\n" + "Details: " + err.ToString() );
}
finally
{
connMain.Close();
}
-----------------------------------------------------
I wonder what is wrong with the code I have.
Thanks again.
Dion
|
|
|
|
|
What was the error message that you got?
What SQL Insert/Update/Delete statements were you using?
Andy Harman
|
|
|
|
|
After about a day, I finally figured out what is wrong. In my DB table, I have a column called "Value". It caused the crash.
Thanks anyway.
Dion
|
|
|
|
|
Hi,
I am developing a simple WinForm app with datagrid on the form. I want to know when any cell text changed so that I can enable my Save button. What event should I handle? Any example will be even better. Thanks.
Dion
|
|
|
|
|
I'm creating a simple Access Database with one table and one boolean field via ADOX and Jet Oledb Provider.
The following code gives me an IDispatch Error 3105 when appending the Table. Note that with adInteger or adVarWChar the code is working. Any idea ? Thx in advance.
pThisAdoCatalogPtr.CreateInstance(__uuidof(Catalog));
pThisAdoTablePtr.CreateInstance(__uuidof(Table));
pThisAdoColumnPtr.CreateInstance(__uuidof(Column));
pThisAdoCatalogPtr->Create("PROVIDER=Microsoft.Jet.OLEDB.4.0;Jet OLEDB:Engine Type=4;Jet OLEDB:System Database=c:\\MsOffice\\Access\\System.mdw;Data Source=mybase.mdb;User Id=admin;Jet OLEDB:Database Password=mypass;");
pThisAdoTablePtr->Name="MyTable";
pThisAdoColumnPtr->Name="BooleanColumn";
pThisAdoColumnPtr->Type=adBoolean;
pThisAdoColumnPtr->Attributes=adColNullable;
pThisAdoTablePtr->Columns->Append(_variant_t((IDispatch *)pThisAdoColumnPtr), adBoolean, 0);
pThisAdoCatalogPtr->Tables->Append(_variant_t((IDispatch *)pThisAdoTablePtr)); <--- Here is the exception thrown.
Bruno.
|
|
|
|
|
Hiya I have an MFC app that writes data to my SQL database. The columns lenghts are set to 30. But when I open my SQL database to view the contents, I can only see the first 15 chars of each column..
How do I get the SQL database to display the full columns lenghts when it is opened??
Thanks,
grahamoj.
|
|
|
|
|
Are you passing spaces at the end of the values at all, is it 30 characters of data, could you be trimming the values?
-Nick Parker
|
|
|
|
|
in query analyser, tools menu, options, results tab, maximum output characters per column.
jon
#include <beer.h>
|
|
|
|
|
Hiya thanks, have checked that but it is already set to 256 chars.
What I do is write the info to the database and then using Enterprise Manager, go in to the table to view it. All of the string is in the column. I can see it when I expand the column.
What I want to be able to do is when I open the table in Enterprise Manager, I want the column already expanded to the full lenght of the string...
Any ideas,
grahamoj
|
|
|
|
|
Hy guys,
I have a question relative to passing parameters of Class Accessor:
Below an extract of my code:
string sqlcmd;
sqlcmd = "UPDATE FileLocation \
SET LastAccessTime = CONVERT(DateTime,???????,121), \
LastUpdateTime = CONVERT(DateTime,??????,121) \
WHERE ([Index] = 1)";
// if(FAILED(ThedboSPSelectAccessor.Open(DBSession, _T("{ ? = CALL dbo.SPdboTWOModifyTime;1 (?,?) }"))))
if(FAILED(ThedboSPSelectAccessor.Open(DBSession, sqlcmd.c_str() ) ) )
I tried to using the calling of store procedure and all it's OK,after I tried to use a sql command but I don't know like to pass the two parameters (indicated as ?????), I tried using ? or (?) or '?' but noone is correct...
Can someone help me???
Thanks in advance.
Andrea
|
|
|
|
|
Is it possible to define one db connection only, then define multiple dataReader assoiciated with that connection in ADO.net? If yes, how to do it? Thanks!
|
|
|
|
|
In general, it's not wise to do so. In a single threaded application you might orchestrate these DataReaders to use only one connection (that means one at a time, but that's probably not what you want), but in any multi-threaded environment (like ASP.NET) you will get into all kinds of trouble.
Rely on the underlying data provider to perform connection-pooling, and open a connection for each operation. For SQL Server you can specify a connectionstring a la: "Server=SVR1;Database=Northwind;...;Pooling=true"
This will force the re-use of connections, and makes opening one a lot cheaper.
Gertjan Schuurmans
Amsterdam
The Netherlands
|
|
|
|
|
= Server=SVR1;Database=Northwind;...; Pooling=true"
Gertjan Schuurmans
Amsterdam
The Netherlands
|
|
|
|
|
No you can't have multiple datareaders open at the same time for the same database connection.
You might want to think of the following alternatives:- Open, read, then close each of your datareaders in sequence.
- Execute all of the queries using a single datareader (e.g. "select * from a ; select * from b ; select * from c"). The datareader is able to process multiple resultsets (for many database products).
- Read each of your queries into a DataSet object then do whatever processing you need against the DataSet.
- Open multiple database connections.
Your choice depends upon what processing you are trying to achieve.
Hope this helps.
Andy Harman
|
|
|
|