|
Putting the subquery as it's own entity so that I could access it like a table in the main one let me get what I needed working.
Otherwise [Microsoft is] toast in the long term no matter how much money they've got. They would be already if the Linux community didn't have it's head so firmly up it's own command line buffer that it looks like taking 15 years to find the desktop.
-- Matthew Faithfull
|
|
|
|
|
I am new to C# and I am trying to convert some old VB6 code to the new platform.
I am importing a text file ".txt" and want to put the data into a database.
In VB6 you could create a recordset for the database in ram and store it there while you are using it and then delete it.
I would like to accomplish the same task in C# but I am having some problems.
The code I am using is as follows:
private ADODB.Connection cn = new ADODB.Connection();
private ADODB.Recordset rs = new ADODB.Recordset();
public frmMainAlarm()
{
InitializeComponent();
rs.Fields.Append ("ID", ADODB.DataTypeEnum.adInteger, 4, ADODB.FieldAttributeEnum.adFldUpdatable, -1);
rs.Fields.Append("Alarm", ADODB.DataTypeEnum.adChar, 255, ADODB.FieldAttributeEnum.adFldUpdatable, -1);
rs.Fields.Append("Message", ADODB.DataTypeEnum.adChar, 255, ADODB.FieldAttributeEnum.adFldUpdatable, -1);
//rs.CursorType = ADODB.CursorTypeEnum.adOpenStatic;
//rs.LockType = ADODB.LockTypeEnum.adLockOptimistic;
rs.Open(null, null, ADODB.CursorTypeEnum.adOpenStatic, ADODB.LockTypeEnum.adLockOptimistic, -1);
}
I get an error at the "rs.Fields.Append" statement saying it has the wrong variables or data types.
Any help would be greatly appreciated.
Keith Mabey
|
|
|
|
|
If you are using the same code in C# then it will not compile you have to write C# equivalent code to this vb6 code
1 - write code to read from file and then
2 - make a SqlConnection object
3 - make a SqlCommand object
4 - through SalCommand object call the ExecuteNonQuery method
|
|
|
|
|
I am tring to create a virtual database in RAM (Memory).
Fill the database table with data from a text file.
Then manipulate the data and rewrite it back out as an XML file.
|
|
|
|
|
|
write code
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
|
vinodh.s wrote: can you plz give me an example.so tat i can get a claer view.
An example of what? You haven't explained what you want to do.
I suggest you read the forum guidelines on message etiquette. Asking vague questions isn't likely to appeal you to the users of this forum. State clearly what your problem is and what you want to achieve and perhaps someone will help you.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
need an example of creating a table with a column name declared of datetime datatype.......
|
|
|
|
|
Don't delete your messages on a thread. It's rude.
Have you tried to solve the problem yourself? What code have you written?
Documentation for the CREATE TABLE[^] statement is easily available on the web. I suggest you read it and attempt to solve the problem yourself before asking for help again.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
|
Most frustrating. The format of the website cannot be changed:
I have 5 web pages each with a form. These page forms have content the user can edit & redit.On the top of each page is a menu bar affording the user to toggle back and forth to any of the 5 pages viewing the respective content. Now say the user toggles to page 2, makes changes to the content, via a RadEditor, toggles to page 5, then retoggles to page 2 to see the changes he just made.
Here's the delema: During these edits/redits, the revised content CANNOT be posted as an update to the database. Only AFTER the user is satisfied with all the edits made, does he click button 6 for "Update All My Changes".
I cannot have one page with all the form elements listed via visible/not visible panels. I cannot use session objects, or cookies - there is just too much data. I heard about the cache object / application object but I do not know if it plays a part here. Also note there could be thousands of concurrent users taking this initially identical data content then editing it to each's own unique wants.
I know this may sound more of a .Net question but I thought as DB ppl here, you must have more experience on this need then others.
So in short, how can I have several editable web pages of form elements that allow the user to see the changes they made, even after clicking off and then back to that form without using a database update or items mentioned above. Remember, They will not let me hit the database until aff the edits on the 5 web page forms are complete. Thanks.
Update:
I have reevaluated the entire process.
I've decided to utilize the file stream object and have them edit their entire page.
Now, I have to figure out how to reiterate thru these modified forms to place the data into the db.
modified on Tuesday, February 26, 2008 4:39 PM
|
|
|
|
|
If you're writing to the database through a DataSet, you can update the dataset, store it in cache and finally update the db using the dataset when the user is satisfied. Your dataset should have all tables and relations and the relevant update and insert commands defined. It all depends on how you've designed your data layer. I presume that this should be easy if you're using Enterprise Library or something similar. Also, the server will put the cache to the pagefile if it grows too big. The flip side is that this will make your webpage slower. You can keep the user interested using ajax style progress bars/indicators etc while the page loads.
SG
Cause is effect concealed. Effect is cause revealed.
|
|
|
|
|
That all sounds great dude, do you know of an actual working VB.net demo I can view that details how that all works?
If it helps, I have a radeditor. Initial it loads with generic info, that everyone sees. Each user is allowed to edit and tailer the content in that rad editor, including uploading/inserting images, to their heart's content. They then click to view another page they may want to edit. I need all the changes/image inserts from that prior page to hang somewhere, but not the database, until the very end.
So, do you know of any VB.net demo online illustrating this?
TYVM
|
|
|
|
|
New to ADO .NET (& C#), please help..
I have multiple questions on connecting to SQLServer 2005. I'm doing the following in my code:
SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
builder["Server"] = cmboBoxServerName.Text;
builder["Data Source"] = cmboBoxServerName.Text;
builder["Initial Catalog"] = cmboBoxDBName.Text;
builder["integrated Security"] = true;
builder["Trusted_Connection"] = true;
strConnectStr = builder.ConnectionString;
IDbConnection connection = New SqlConnection();
connection.ConnectionString = strConnectStr;
connection.Open();
This is working fine if I have SQL Native Client installed on my machine.
When I deploy this on a machine witout SQLNativeClient I get the error:
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'my domain\ my username'.
My questions:
1. Is 'SQL Native Client' required to connect (through my C# App using ADO.NET) to a remote SQL Server ?
2. When is SQL Native client required and when is not? What is the purpose of having a SQL Client for ADO.NET Apps?
3. What is the difference between builder["Server"] and builder["Data Source"]?
4. What is the difference between builder["integrated Security"] and builder["Trusted_Connection"]?
5. What is the minimum number of SQL Client licenses per Server?
6. What is SQL Express and can I use it with ADO .NET? Can I use it as an alternative if don't have enough licenses? Again, should I install it on every machine as well even if I ought to connect to a centralized remote database?
Looks like I have multiple issues and I'm getting confused with my limited knowledge.. I just want to clear out one by one..
Please direct me to any tutorial that handles case by case set up scenarios..
from local server to remote server to cross platform..
Thanks a lot!
-ap
|
|
|
|
|
wrong section, you should ask it in C#
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
|
1. Is 'SQL Native Client' required to connect (through my C# App using ADO.NET) to a remote SQL Server ?
No, not if you're using Managed API (Data.SQLClient)
2. When is SQL Native client required and when is not? What is the purpose of having a SQL Client for ADO.NET Apps?
If your application uses ADO or OLEDB or ODBC or other API's to access SQL Server
3. What is the difference between builder["Server"] and builder["Data Source"]?
Both refer to the same thing.
4. What is the difference between builder["integrated Security"] and builder["Trusted_Connection"]?
Both refer to the same thing. Both this and the question above is
probably because you can use multiple interchangeable keywords in the SQLConnection ConnectionString property.
Refer to <a href="http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring.aspx">this</a>[<a href="http://msdn2.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring.aspx" target="_blank" title="New Window">^</a>] article for details.
5. What is the minimum number of SQL Client licenses per Server?
Depends on what kind of license you've bought for your server. There are per CPU licenses
and per connection licenses. IIRC you'll get atleast 5 connetions if you opt for the per
connection license.
6. What is SQL Express and can I use it with ADO .NET?
Yes. Definitely
Can I use it as an alternative if don't have enough licenses?
Yes again
Again, should I install it on every machine as well even if I ought to connect to a centralized remote database?
If you're using a centralized server, you don't have to use the Express Edition. Express
edition is meant to be a standalone database on every system and is not looked
at for multiple users.
Read <a href="http://www.microsoft.com/sql/howtobuy/faq.mspx">this</a>[<a href="http://www.microsoft.com/sql/howtobuy/faq.mspx" target="_blank" title="New Window">^</a>]
and <a href="http://www.microsoft.com/sql/prodinfo/features/compare-features.mspx">this</a>[<a href="http://www.microsoft.com/sql/prodinfo/features/compare-features.mspx" target="_blank" title="New Window">^</a>] for further clarifications.
SG
Cause is effect concealed. Effect is cause revealed.
|
|
|
|
|
Thanks a lot!
.. lot of things cleared!
I can now start off from here..
Thanks Again!
-ap
|
|
|
|
|
I am creating application using asp.net and c# and Oracle 10G as database. I am using Nhibernate
When I execeute from query from my page query first time it works fine and also do its job but in the same session if i try to run the same query it is giving me an exception which is
“From Keyword exception”.
The query is written on Command button using a Command button.
I have debugged the code and from the command object I pick up the query and run into SQL developer its running fine.
I also assure as Nhibernate session is also closed.
I also try Global.asax to close the Nhibernate Session.
To start with it looks like session problem which i tried to knock out by closing session, reader, object and also disposing command object.
Any suggestion to resolve this .
Thanks
Waqas
Waqas
|
|
|
|
|
You're going to have to supply us with more information. What is the query you are running? What code are you running to execute the query? What is the exact wording of the error you are getting?
|
|
|
|
|
hi all
can anyone tell me how to count the number of records(rows)in a table without using "COUNT" aggregate function.
thanx in advance.
pintoo
|
|
|
|
|
chithra.r wrote: without using "COUNT"
What is that you are trying to do? If you are writing a proc, you may use @@RowCount[^]
Pl: Read through the documentation listed in the above URL, to know the scenarios where it can be applied.
Give a man a fish, he'll eat for a day. Teach a man how to fish, he'll eat for lifetime.
Pradeep Joe
|
|
|
|
|
@@Rowcount is only gives you the number of rows affected by the last query, for example
select count(*) from table1
will give an @@RowCount of 1
The best way I know of without using select count(*) is
EXEC sp_spaceused 'tablename'
which gives you
name rows reserved data index_size unused
If you only want an approximate count
select max(rows)<br />
from sysindexes <br />
where indid < 2<br />
and id = object_id('TableName')
(this is not 100% accurate as rows sysindexes is not always updated)
Bob
Ashfield Consultants Ltd
|
|
|
|
|
What's wrong with COUNT()?
|
|
|
|