Update 2: I solved this, see my answer.
I am invoking queries in a Microsoft Access database from C# using OleDb, but I can't get my update queries to work.
No error is thrown, but updates are not persisted in the database.
Can anyone shed any light on this?
SQL query in the database:
UPDATE tableName SET tableName.LastPolledD...
I have a MySQL table called bb_posts used by a bbPress forum. It has an autoincrement field called topid_id and another field called topic_poster.
I'm trying to write a function that finds the "next post by the same author". So, for instance, say the user is on a particular page that displays topic 123. If you do a SQL query:
SELECT *
...
Which way is preferred?
SqlCommand = new SqlCommand(query);
command.Parameters.Add("@Foo");
command.Parameters[0].Value = Foo;
command.Parameters.Add("@Bar");
command.Parameters[1].Value = Bar;
// or
command.Parameters.Add("@Foo");
command.Parameters.Add("@Bar");
command.Parameters["@Foo"].Value = Foo;
command.Parameters["@Bar"].Valu...
I'm trying to do this in a SQL Server CE database, but the database engine keeps reporting errors.
SELECT C.guid, C.name, C.updated,
C.hddsize, C.hddavailable, C.hddfree,
C.ramsize, C.profiles, C.cpu,
(SELECT COUNT(D.id) AS numprogs
FROM ComputerData AS D
WHERE D.computer_id = C.id) AS numprograms
FROM...
What method do you use to get a compile time error when the database schema changes occur in an ASP.NET project?
For example, if you have a GridView bound to a DataSource, I can only get runtime errors when a schema change occurs, not a compile time error. Intellisense works fine on the code behind using datasets, LINQ, etc, but I cant...
Hi,
I have a model like:
Question
- Id
- CreatedOn
Answer
- Id
- CreatedOn
- QuestionID
No I want to get the first question with the newest answer.
I am using SQL Server 2005.
Thanks,
Chris
...
Is it possible to use a Case statement in a sql From clause. For example, I'm trying something like:
SELECT Md5 FROM
CASE
WHEN @ClientType = 'Employee' THEN @Source = 'HR'
WHEN @ClientType = 'Member' THEN @Source = 'Other'
END CASE
WHERE Current = 2;
Edit: Using SQL 2005
...
I consider myself a very experienced SQL person. But I'm and failing to do these two things:
Reduce the size of the allocated log.
Truncate the log.
DBCC sqlperf(logspace)
returns:
Database Name Log Size (MB) Log Space Used (%) Status
ByBox 1964.25 30.0657 0
The following does not work with SQL 2008
DUMP TRANSACTION ByBo...
Is it beneficial to use multicolumn (composite) primary keys for a many to many relationship table when using Linq to SQL?
Or should I just add an identity column as a non-clustered primary key and index the FK columns appropriately?
...
does setting up proper relationships in a database help with anything else other than data integrity?
do they improve or hinder performance?
...
In your experience, at about how many records does insert performance become intolerable when using a clustered index on not-typically-unique columns?
A good example I can think of would be the comments table for stack overflow. Do you think that insert performance would be acceptable if the comments table had a clustered index on their...
You require an algorithm to read in one customer's account balance at the begining of the month, a total of all withdrawals for the month, and a total of all deposits made during the month. A federal tax charge of 1% is applied to all transactions made during the month. The program is to calculate the account balance at end of the month ...
Hello all,
I have this SQL statement:
SELECT * FROM converts
WHERE email='[email protected]' AND status!='1'
ORDER BY date ASC, priority DESC
This just orders by date but I want to give my column "priority" more authority. How can I do this?
It should order by date first but if the time between two records is 10 mintues then...
SQLite version 3.4.0
What's wrong with aggregate functions? Additionally, I suspect that ORDER BY won't work as well. How to rewrite this?
sqlite> SELECT p1.domain_id, p2.domain_id, COUNT(p1.domain_id) AS d1, COUNT(p2.domain_id) AS d2
...> FROM PDB as p1, Interacting_PDBs as i1, PDB as p2, Interacting_PDBs as i2
...> WHERE p1.id ...
By using sp_who2 I can get a list of current log-in users and machine names. Some users are using SQL Server log-in user name such as sa. Is there any way I can get the windows log-in user name for the SQL log-in users?
If there is no way to get Windows log-in users from the machine names, can I use WMI class or C# to get find out the W...
I'm having some trouble with a tricky SQL-query.
In my MySQL database there is the tables topics, tags and tags_topics to join them.
I want to fetch topics that share the same specified tags. For example, let's say i have 3 tags with ids 1, 2 and 3, i want to fetch all topics that have tag 1, 2 and 3 associated to them. The topics can ...
I need to create a simple windows app for my father's business that handles employee records that can be entered and retrieved though a search and output to excel or something similar. I was thinking of using C++ and using MySQL as the database. I want to make it as simple and seamless as possible, so I am completely open to suggestions ...
Every Customer has a physical address and an optional mailing address. What is your preferred way to model this?
Option 1. Customer has foreign key to Address
Customer (id, phys_address_id, mail_address_id)
Address (id, street, city, etc.)
Option 2. Customer has one-to-many relationship to Address, which contains a field...
I have a project I am working on. based off a backup SQl Server database from a production server. They have over 16,000 user email addresses, and I want to corrupt them so the system (which has automatic emailers) will not send any emails to valid addresses.
But I still want the users, and I want them in a way that I can reverse wha...
If I run the two statements in batch will they return one table to two to my sqlcommand object with the data merged. What I am trying to do is optimize a search by searching twice, the first time on one set of data and then a second on another. They have the same fields and I’d like to have all the records from both tables show and be ...