database

c# sql database - how to reada all specific rows from table?

Hello all, I have a SQL Table "Roles" in DB. I want to find out if user have one or more Roles (Admin/User) and then do something with a value if user have 2 Roles at time. Problem: I cant get all Values from Database, I getting just a first one. can I do it with foreach loop? I dont have it here but i'm looking for solution. like: ...

UNIQUE Constraint in SQLite

Hi, Can some one please help me with this problem.To save the values in my iphone app, I am using SQLite3. I have many duplicate values in my database. So, to eliminate that I am planning to write some unique constraint on the table. My constraint should be such a way that a contact whose firstname,lastname and email are same, I want to ...

how to send database data to a MySQL server to update the server database.

Hi everyone, I am developing Smoking counter and I need to send all the smoking record (about the time user smoking) to database on the server. The server database is MySQL database. I knew that I must have send data to PHP page/script, and this page/script will run on the data to insert record to database. I would like to know: is the...

Defining Status of data via Enum or a relation table

I have an application which has rows of data in a relation database the table needs a status which will always be either Not Submitted, Awaiting Approval, Approved, Rejected Now since these will never change I was trying to decide the best way to implement them I can either think of a Status enum with the values and an int assigned whe...

Table and Field naming for fresh database + documentation Q

We are startingt o build the database fresh, lots of tables and fields to create for a social website. There will be heavy API implemntation so I am pushing the tech team for solid documentation of data schema, however lost on naming for fields and tables. I want it to all be user friendly, maybe specify the type of table it is also lik...

Postgres statistic gathering

Statistics can be turned off for specific columns on a table. Can someone point me to the pg table that tells me which columns of a relation are not having stats gathered on? I have already looked at pg_stats and pg_statistics ...

Check for specific column in Android SQLite database

I am trying to check if there is a specific column in my database when onUpgrade() gets called. Is there an easy way to check like if(database does not have specific column){ db.execSQL("ALTER TABLE table" + " ADD COLUMN column" ); } I saw some other answer, Pragma Table, but I don't know how to use it or even what it really is for. ...

Sql Server - Remove End String Character "\0" From Data

I have a column in the database (SQL Server 2005) that has data with a "\0" at the end. When querying in SQL Server, this character is not visible and does not "seem" to exist. When I look in my C# code, the character is there. This character is causing an error on our website, and we need it removed from all the affected rows. Is th...

Database structure for storing historical data

Preface: I was thinking the other day about a new database structure for a new application and realized that we needed a way to store historical data in an efficient way. I was wanting someone else to take a look and see if there are any problems with this structure. I realize that this method of storing data may very well have been in...

Database and web service models

I'm watching the 2010 Google I/O video on this topic and I have a few questions to make sure I understand properly. Google I/O 2010 - Android REST client applications Please note I also have a very limited understanding of CursorAdapters Right now my application just has a UI layer. I've created an object called DbAdapter using some ...

MS Access DB Query String Parameter Issue

I'm having some trouble getting results from a c# OleDbCommand on an MS Access database. Here's my command: SELECT START_DATE FROM tblVisits WHERE LocProj_IS_NUMBER = @projId AND LocSTATN_IS_NUMBER = @statnId AND LocSTATN_ORG_ID = @orgId AND LocProj_ORG_ID = @orgId If I call this using parameters, I get no results, BUT if I replace @o...

SQL -> MongoDB Export Performance Issues

I'm trying to set up an automated process to regularly transform and export a large MS SQL 2008 database to MongoDB. There is not a 1-1 correspondence between tables in SQL and collections in MongoDB -- for example the Address table in SQL is translated into an array embedded in each customer's record in Mongo and so on. Right now I ha...

How to create a table from the results of a SQL query?

How can I put the results of a query into a table which is NOT created? For example, put the following query results into a new table EmployeeDetail which IS NOT CREATED. Create the table and put the results at the same time. select a.Name, b.Id from Database1 a left join Database2 b ON a.Id = b.Id How can this be done? ...

Command.Prepare() Causing Memory Leakage?

I've sort of inherited some code on this scientific modelling project, and my colleagues and I are getting stumped by this problem. The guy who wrote this is now gone, so we can't ask him (go figure). Inside the data access layer, there is this insert() method. This does what it sounds like -- it inserts records into a database. It is ...

Python doesn't save data to sqlite db.

This is my code: conn = sqlite3.connect(nnpcconfig.commondb) cur = conn.cursor() query = ['2124124', 'test2', 'test3', 'test4', 'test5'] cur.execute("insert into users(id, encpass, sname, name, fname) values (?, ?, ?, ?, ?)", query) conn.commit cur.execute("select * from users") for row in cur: print row This code works, returning...

MySQL Database - Related Results from same table / Many to Many database design problem

Hello, I am designing a relational database of products where there are products that are copies/bootlegs of each other, and I'd like to be able to show that through the system. So initially during my first draft, I had a field in products called " isacopyof " thinking to just list a comma delimited list of productIDs that are copies o...

Rails: how to use conditions and only let the db look 100 records deep, I'm not looking for limit

I'm adding data to a db and I only need to check for duplicated data within the last 30 minuets or so. Data is getting added at about 10 entries per minuet so I only need search about 300 records. How can I get this in conditions with rails Model.find(:all, :conditions => [])? ...

illegal state exception in android when inserting data in database

According to my application i create the database with two tables. when i inserting the data in 1 table then it runs correctly after that when i save data in the second table then it gives the exception of illegal state exception (database cannot be open). Please give me the solution. ...

Rails Migration to convert string to integer?

Hi Everyone, Is it possible to change a field that's a string to an integer without clearing the data already entered? The current db structure for the table in question is: create_table :people do |t| t.string :company_id Is this possible using migrations? I'm thinking maybe in the migration drop the old field, create a new one t...

Which column of database table order_products is connected with google checkout in oscommerce?

I am new to Google Checkout and oscommerce please help me find the below: Which column of database table order_products is connected with google checkout in oscommerce? Google checkout displays the price details of every product, from where does this detail comes from? ...