database

exposing sql server data from an asp.net webapp to silverlight and win forms via linq

hi, I have an asp.net web app which holds its data in an sql server 08 r2 db. I have a silverlight admin interface on the same web app, and I will have a win forms app which will need to add/retrieve data from the sql db. Is there a way I can use linq in both clients? I mean something like linq2twitter, where in the silverlight or in ...

creating Models with sqlite3 + datamapper + ruby

How do you build a model with the following associations (i tried but couldn't get it to work): each Order has: a Customer, a SalesRep, many OrderLine that each has an item. I tried: when I do: Customer.all(Customer.orders.order_lines.item.sku.like => "%BLUE%") the output is :[] instead of: '[#<"Customer @id=1 @name="Dan Kubb">]' Whe...

Zend Framework: Populating DB data to a Zend Form dropdown element

Hi I have the following form: <?php class Application_Form_RegistrationForm extends Zend_Form{ public function init(){ $country = $this->createElement('select', 'country'); $country->setLabel('country: ') ->setRequired(true); $email = $this->createElement('text', 'email_address'); ...

Database Usage from Network Server

I am running desktop app that uses mdf file on local path.What if I want to do is that this mdf file should be placed over a network shared folder but network is using Domains and we need password to connect to that folder.Server is running windows Server and dont know if it has installed SQL Express or not. Q 1-> do server needs to hav...

How to document database efficiently (tables, attributes with definition)?

We have a fairly large database (in SQL Server 2008) with many tables. We have just bought Red Gate's SQL Doc for documentation purposes. We would like to document this database in a detailed way. What is the best practice in documenting a database? How do you document your attributes with definitions? SQL Doc documents the database nice...

The Relational Model & Queries That Naturally Return Duplicate Rows

It's commonly understood that in the relational model: Every relational operation should yield a relation. Relations, being sets, cannot contain duplicate rows. Imagine a 'USERS' relation that contains the following data. ID FIRST_NAME LAST_NAME 1 Mark Stone 2 Jane Stone 3 Michael Stone If someone runs a query se...

Calling LDAP from a Stored Procedure

Background I'm trying to migrate from an LDAP identity store to a database backed implementation. There will be a migration period in which it will be necessary to sync any changes to passwords on the database with the LDAP store. My question is if its possible to make a LDAP modify call from a stored procedure on the Oracle Database. ...

Which gives a faster query? Which is cleaner? JOIN ON or WHERE

When should I be using JOIN ON or WHERE in a scenario like the one below? DECLARE @PhoneNumber int = 5551234 -- JOIN ON SELECT * FROM Persons JOIN Employees ON Persons.DateOfBirth = Employee.DateOfBirth AND Persons.PhoneNumber = Employees.PhoneNumber WHERE Persons.PhoneNumber = @PhoneNumber -- WHERE SELECT * FROM Persons JOIN Employ...

beginners question about creating relationships between tables

my question specifically about sql-server, but probably can be answered by anyone with any database background if i want table A to have a 1:1 relationship with table B on a certain column, should i somehow modify the CREATE TABLE statement to identify this relationship or is this something that is not done at all (and rather it is hand...

Using a varchar(MAX) or a varbinary(MAX) to store an length-undefined string within SQL Server

Hi There! I am making a CMS of sorts and, of course, it will have a blog. So, this might be a pretty noob question, but, from a database optimization point of view, would you use a varchar(max) or a varbinary(max) to store the body of a blog post? ...

Possible to connect hosted web application to local database?

Is there any tech out there that allows for a hosted web application to connect to a local database? For example, say I would like to write some web-based software for a popular point-of-sale solution. The ideal would be to have the customer input their database connection credentials and have the application connect to their locally hos...

Better to commit inside or outside a loop?

Maybe there's no simple answer to this question, but I ask in case someone has, if not a simple answer, at least an insight. I've had a number of occasions where I create a loop that goes through many records in a database table performing some update, and where I could legitimately do one big commit at the end, or commit each record as...

Display column values from database

Hi. I'm trying to display all the values from a specific column created by my Wordpress plugin (specifically, the ID's). Here is the code I have managed to use to display the column names, but I cannot get it to just display all the ID's. Here is the code: function test() { global $wpdb; global $table_name; $testing = $wpdb-...

Do triggers maintain atomicity even if the application crashes

I have a situation where I have 2 tables in which I can do Insert,Update,Delete.I'm introducing a table audit_trail to maintain a log of changes of this two tables.Now to enter values in audit_trail table I have written insert statements after any Update,Delete or Insert on either of the table.Now if an modification happened on one of th...

moving tables between databases

For a bit fall cleaning, I am moving 25 tables between MySQL databases (different pieces of hardware). This is not the WHOLE database, just 25 tables out of a few hundred... These tables don't really belong in there, I won't go into why for NDA reasons. Now, this is going to break a lot of code and sql queries. What is the best way t...

Should my RDBMS or my Application handle database Referential Integrity?

Should items like Foreign Keys, Constraints, Default Values, etc be handled by the Database management system (in this case, MS Sql 2005) or the Application? I have heard opinions from both sides and I'm honestly not sure which way to go. I originally was going to build it into the database, however I have discovered this is not always ...

What is the Best Database Choice for a Single User .NET Winforms Application

I'm writing a new .Net 3.5 Winforms single user application and I'm not sure which database I should use. The database consists of about 30 tables and maximum rows in a table will not exceed 50,000. The database should be password protected so the client user cannot view the structure or modify data manually. I'd rather prevent further i...

Lazy Initialization for data access

I'm accessing database to bulk populate fields. PopulateAobjs(); PopulateBobjs(); PopulateCobjs(); ... Once the values are populated, I store the entities in a Dictionary<Id, Entity>. I'd like to make this process lazy, in such a way that, if I don't need C objects then I don't need to call that method. etc. How can this be done? L...

Is having multiple data/log files a good thing even on the same LUN?

I have read that it is a good idea to have one file per CPU/CPU Core so that SQL can more efficiently stream data to and from the disks. Ok, I can see the benefit if they are on different spindles, but what if I only have one spindle (4 drives in Raid 10) for my data files (.mdf and .ndf), will I still benefit from splitting the data fi...

How to show an auto-incremental ID on a "create new record" form with Rails

I'm trying to create a form that will show the id that the record is going to have, prior to hitting submit on the form. For example, if I have a form to create a new project, and the previous project was id 3, I want the new project form to autopopulate with 4, so that I know that it's going to be 4 before I submit the form. Thanks for...