Search Results

Search found 26929 results on 1078 pages for 'table cell'.

Page 16/1078 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Adding a second table in a database

    - by MB
    Hi everyone. I used the code provided by the NoteExample from the developers doc to create a database. Now I want to add a second table to store different data. I simply "copied" the given code, but when I try to insert into the new table I get an error saying: "0ERROR/Database(370): android.database.sqlite.SQLiteException: no such table: routes: , while compiling: INSERT INTO routes(line, arrival, duration, start) VALUES(?, ?, ?, ?);" Can someone please take quick look at my DbAdapter class and give me a hint or a solution? I really don't see any problem. my code compiles without any errors.. thanks in advance! CODE: import static android.provider.BaseColumns._ID; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; public class DbAdapter { public static final String KEY_FROM = "title"; public static final String KEY_TO = "body"; public static final String KEY_ROWID = "_id"; public static final String KEY_START = "start"; public static final String KEY_ARRIVAL = "arrival"; public static final String KEY_LINE = "line"; public static final String KEY_DURATION = "duration"; private static final String DATABASE_NAME = "data"; private static final String DATABASE_NOTESTABLE = "notes"; private static final String DATABASE_ROUTESTABLE = "routes"; private static final String TAG = "DbAdapter"; private DatabaseHelper mDbHelper; private SQLiteDatabase mDb; /** * Database creation sql statement */ private static final String DATABASE_CREATE_NOTES = "create table notes (_id integer primary key autoincrement, " + "title text not null, body text not null)"; private static final String DATABASE_CREATE_ROUTES = "create table routes (_id integer primary key autoincrement, " + "start text not null, arrival text not null, " + "line text not null, duration text not null);"; private static final int DATABASE_VERSION = 2; private final Context mCtx; private static class DatabaseHelper extends SQLiteOpenHelper { DatabaseHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL(DATABASE_CREATE_NOTES); Log.d(TAG, "created notes table"); db.execSQL(DATABASE_CREATE_ROUTES); //CREATE LOKALTABLE db.execSQL("CREATE TABLE " + DATABASE_ROUTESTABLE + " " + "(" + _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + KEY_START + " TEXT NOT NULL, " + KEY_ARRIVAL + " TEXT NOT NULL, " + KEY_LINE + " TEXT NOT NULL, " + KEY_DURATION + " TEXT NOT NULL"); Log.d(TAG, "created routes table"); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { Log.w(TAG, "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data"); db.execSQL("DROP TABLE IF EXISTS notes"); onCreate(db); } } /** * Constructor - takes the context to allow the database to be * opened/created * * @param ctx the Context within which to work */ public DbAdapter(Context ctx) { this.mCtx = ctx; } /** * Open the notes database. If it cannot be opened, try to create a new * instance of the database. If it cannot be created, throw an exception to * signal the failure * * @return this (self reference, allowing this to be chained in an * initialization call) * @throws SQLException if the database could be neither opened or created */ public DbAdapter open() throws SQLException { mDbHelper = new DatabaseHelper(mCtx); mDb = mDbHelper.getWritableDatabase(); return this; } public void close() { mDbHelper.close(); } /** * Create a new note using the title and body provided. If the note is * successfully created return the new rowId for that note, otherwise return * a -1 to indicate failure. * * @param title the title of the note * @param body the body of the note * @return rowId or -1 if failed */ public long createNote(String title, String body) { ContentValues initialValues = new ContentValues(); initialValues.put(KEY_FROM, title); initialValues.put(KEY_TO, body); return mDb.insert(DATABASE_NOTESTABLE, null, initialValues); } /** * Create a new route using the title and body provided. If the route is * successfully created return the new rowId for that route, otherwise return * a -1 to indicate failure. * * @param start the start time of the route * @param arrival the arrival time of the route * @param line the line number of the route * @param duration the routes duration * @return rowId or -1 if failed */ public long createRoute(String start, String arrival, String line, String duration){ ContentValues initialValues = new ContentValues(); initialValues.put(KEY_START, start); initialValues.put(KEY_ARRIVAL, arrival); initialValues.put(KEY_LINE, line); initialValues.put(KEY_DURATION, duration); return mDb.insert(DATABASE_ROUTESTABLE, null, initialValues); } /** * Delete the note with the given rowId * * @param rowId id of note to delete * @return true if deleted, false otherwise */ public boolean deleteNote(long rowId) { return mDb.delete(DATABASE_NOTESTABLE, KEY_ROWID + "=" + rowId, null) > 0; } /** * Return a Cursor over the list of all notes in the database * * @return Cursor over all notes */ public Cursor fetchAllNotes() { return mDb.query(DATABASE_NOTESTABLE, new String[] {KEY_ROWID, KEY_FROM, KEY_TO}, null, null, null, null, null); } /** * Return a Cursor over the list of all routes in the database * * @return Cursor over all routes */ public Cursor fetchAllRoutes() { return mDb.query(DATABASE_ROUTESTABLE, new String[] {KEY_ROWID, KEY_START, KEY_ARRIVAL, KEY_LINE, KEY_DURATION}, null, null, null, null, null); } /** * Return a Cursor positioned at the note that matches the given rowId * * @param rowId id of note to retrieve * @return Cursor positioned to matching note, if found * @throws SQLException if note could not be found/retrieved */ public Cursor fetchNote(long rowId) throws SQLException { Cursor mCursor = mDb.query(true, DATABASE_NOTESTABLE, new String[] {KEY_ROWID, KEY_FROM, KEY_TO}, KEY_ROWID + "=" + rowId, null, null, null, null, null); if (mCursor != null) { mCursor.moveToFirst(); } return mCursor; } /** * Return a Cursor positioned at the route that matches the given rowId * * @param rowId id of route to retrieve * @return Cursor positioned to matching route * @throws SQLException if note could not be found/retrieved */ public Cursor fetchRoute(long rowId) throws SQLException { Cursor mCursor = mDb.query(true, DATABASE_ROUTESTABLE, new String[] {KEY_ROWID, KEY_START, KEY_ARRIVAL, KEY_LINE, KEY_DURATION}, KEY_ROWID + "=" + rowId, null, null, null, null, null); if (mCursor != null) { mCursor.moveToFirst(); } return mCursor; } /** * Update the note using the details provided. The note to be updated is * specified using the rowId, and it is altered to use the title and body * values passed in * * @param rowId id of note to update * @param title value to set note title to * @param body value to set note body to * @return true if the note was successfully updated, false otherwise */ public boolean updateNote(long rowId, String title, String body) { ContentValues args = new ContentValues(); args.put(KEY_FROM, title); args.put(KEY_TO, body); return mDb.update(DATABASE_NOTESTABLE, args, KEY_ROWID + "=" + rowId, null) > 0; } }

    Read the article

  • lua table C api

    - by anon
    I know of: http://lua-users.org/wiki/SimpleLuaApiExample It shows me how to build up a table (key, value) pair entry by entry. Suppose instead, I want to build a gigantic table (say something a 1000 entry table, where both key & value are strings), is there a fast way to do this in lua (rather than 4 func calls per entry: push key value rawset Thanks!

    Read the article

  • add ANOTHER primary key to a table which is UNIQUE

    - by gdubs
    so im having problems with adding another primary key to my table. i have 3 columns: 1. Account ID (Identity) 2. EmailID 3. Data field when i made the table i had this to make the Account ID and the Email ID unique PRIMARY KEY (AccountID, EmailID) i thought that would make my emailid unique, but then after i tried inserting another row with the same emailid it went through. so i thought i missed something out. now for my question: IF, i had to use alter, How do i alter the table/PK Constraint to modify the EmailID field and make it Unique IF i decided to drop the table and made a new one, how do i make those two primary keys uniqe? Thanks a bunch!!

    Read the article

  • Optimizing MySQL for ALTER TABLE of InnoDB

    - by schuilr
    Sometime soon we will need to make schema changes to our production database. We need to minimize downtime for this effort, however, the ALTER TABLE statements are going to run for quite a while. Our largest tables have 150 million records, largest table file is 50G. All tables are InnoDB, and it was set up as one big data file (instead of a file-per-table). We're running MySQL 5.0.46 on an 8 core machine, 16G memory and a RAID10 config. I have some experience with MySQL tuning, but this usually focusses on reads or writes from multiple clients. There is lots of info to be found on the Internet on this subject, however, there seems to be very little information available on best practices for (temporarily) tuning your MySQL server to speed up ALTER TABLE on InnoDB tables, or for INSERT INTO .. SELECT FROM (we will probably use this instead of ALTER TABLE to have some more opportunities to speed things up a bit). The schema changes we are planning to do is adding a integer column to all tables and make it the primary key, instead of the current primary key. We need to keep the 'old' column as well so overwriting the existing values is not an option. What would be the ideal settings to get this task done as quick as possible?

    Read the article

  • wordpress use table sort functionality in own plugin

    - by choise
    Hi, im creating a own plugin for wordpress where i have to view a set of data. now i want to use the wordpress default table view to display my data, and give some functionality to it default table: is there a way to use this table view for my own plugins (some classes or functions) or do i have to create something similar by myself?

    Read the article

  • table problem in loop

    - by air
    i have one table in loop which come under li <?php for($i=1;$i<=$tc;$i++) { $row=mysql_fetch_array($result); ?> <li style="list-style:none; margin-left:-20px"> <table width="600" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="hline" style="width:267px"><?php echo $row['tit'] .",". $row['name'] ?></td> <td class="vline" style="width:1px">&nbsp;</td> <td class="hline" style="width:100px"><?php echo $row['city']; ?></td> </tr> </table> </li> <?php } ?> the out put comes like this i can't put table outside the loop, due to li sorting thanks

    Read the article

  • VWD Express won't let me add one table!

    - by user530809
    Sorry if this question is too trivial but I really haven't found any related questions and I am shaking too much to think logically. I spent like few hours waiting for SQL Server to finally install (you know, it's Microsoft) and now when I want to add new table to database it says "this feature is not supported by Microsoft Visual Web Developer Express". How could this happen? I mean, what's the point of even letting me use this if I can't even add one table to database, and I won't even know about it until I actually need to do it? Are they really serious or is it just some mistake? Is there any way to get around this problem? I need to create just one simple project with one small table in database but it won't let me, but I can't believe they could actually have nerves to make express edition without such a trivial function, so maybe I just made something wrong and there's actually some way to add this table? Sorry for being so whiny but I'm just fed up with this environment.

    Read the article

  • Style row banding and selection in tr:table using CSS

    - by Alex Larzelere
    I've got a tr:table that I need to style using CSS. All the normal style functions of a table are working, but row banding and row selection aren't coming up. When I view the rendered source, I'm not seeing a difference in the rows for an id or class to grab on to, and the official documentation doesn't have any attributes for declaring a style class for either. Is this possible and if so what do I need to do to get my CSS to grab onto it? <tr:table id="myTable" value="#{tableValues}" rowBandingInterval="1"> <tr:column> ##Stuff## </tr:column> <tr:column> ##Stuff## </tr:column> <tr:column> ##Stuff## </tr:column> </tr:table> Edit Let me try to clairfy what's happening. First, using the declaration above tells jsf to generate a table, and the attribute rowBandingInterval tells it to give each row alternating colors (If it was set to 2, then it would do 2 rows one color, 2 rows another, 2 rows the original, etc.) Once the page gets rendered into standard html, trinidad (and jsf) apply their own classes and IDs to the html. My normal procedure is to look at the rendered html, find the class that it is appling and add CSS rules for it. However in this case, no additional styles are added (nothing in the rendered html denotes one row to be different from another). So the question is, how do I tell trinidad to either give alternating rows and the user selected row different classes/IDs for me to grab on to with CSS?

    Read the article

  • PHP HTML table is too wide

    - by typoknig
    I have a table that I cannot get to size correctly. The table populates with information from a database via a loop. Sometimes if the data is too long the table extends past where it should. When the data is that long I want the data to wrap in the cells so the table stays where it should. I have tried the normal table data but it isn't working. Any ideas? <?php echo "<table> <tr> <th>id</th> <th>700-number</th> <th>First name</th> <th>Last name</th> <th>Email</th> <th>Response</th> <th>Created On</th> </tr>"; $num = mysql_num_rows($result); for ($i = 0; $i < $num; $i++) { $row = mysql_fetch_array($result); $id = $row['id']; $school_id = $row['school_id']; $fname = $row['first_name']; $lname = $row['last_name']; $email = $row['email']; $attending = ($row['attending'] == 0) ? 'No' : 'Yes'; $date = $row['created_on']; $class = (($i % 2) == 0) ? "td2" : "td1"; echo "<tr>"; echo "<td class=" . $class . ">$id</td>"; echo "<td class=" . $class . ">$school_id</td>"; echo "<td class=" . $class . ">$fname</td>"; echo "<td class=" . $class . ">$lname</td>"; echo "<td class=" . $class . ">$email</td>"; echo "<td class=" . $class . ">$attending</td>"; echo "<td class=" . $class . ">$date</td>"; echo "</tr>"; } ?> </table>

    Read the article

  • Django/Python: Save an HTML table to Excel

    - by kchau
    I have an HTML table that I'd like to be able to export to an Excel file. I already have an option to export the table into an IQY file, but I'd prefer something that didn't allow the user to refresh the data via Excel. I just want a feature that takes a snapshot of the table at the time the user clicks the link/button. I'd prefer it if the feature was a link/button on the HTML page that allows the user to save the query results displayed in the table. Is there a way to do this at all? Or, something I can modify with the IQY? I can try to provide more details if needed. Thanks in advance.

    Read the article

  • added row to a table with jquery but added rows disappear with browser refresh

    - by user840930
    I added rows to a html table with jquery, but when I refresh the browser, the rows disappear. How can I get the rows to stay? <TABLE id="dataTable" width="100%" align="center"> <TR align="center" border="1"> <TH></TH> <TH>ID </TH> <TH>Name</TH> <TH>Status</TH> </TR> <TR align="center"> <TD><INPUT type="checkbox" name="chk"/></TD> <TD> 1 </TD> <TD> <INPUT type="text" value="Submission 1" /> </TD> <TD>Working version</TD> </TR> </TABLE> <script type="text/javascript"> $(document).ready(function(){ $('#createNew').click(function() { var table = document.getElementById('dataTable'); var rowCount = table.rows.length; $('#dataTable tr:last').after('<TR align="center"><TD><INPUT type="checkbox" name="chk"/></TD><TD>'+ rowCount + '</TD><TD> <INPUT type="text" value="Submission 1" /> </TD><TD>Working version</TD></TR>');

    Read the article

  • database table in Magento does not exist: sales_flat_shipment_grid

    - by dene
    We're using Magento 1.4.0.1 and want to use an extension from a 3rd party developer. The extension does not work, because of a join to the table "sales_flat_shipment_grid": $collection = $model->getCollection()->join('sales/shipment_grid', 'increment_id=shipment', array('order_increment_id'=>'order_increment_id', 'shipping_name' =>'shipping_name'), null,'left'); Unfortunately this table does not exist n our database. So the error "Can't retrieve entity config: sales/shipment_grid" appears. If I comment this part out, the extension is working, but I guess, it does not proper work. Does anybody know something about this table? There are a backend-option for the catalog to use the "flat table" option, but this is only for the catalog. And the tables already exists, no matter which option is checked. Thank you a lot! :-)

    Read the article

  • join two table for insert data in database in android

    - by shadi
    I have two table(t1,t2) in android, t1 has a primary key that it is foreign key for t2,i want to insert data to this tables,is it necessary to join these two table?if yes, what is code for join these table? i insert data in one of them like this: public long insertQuote(String Quote,int Count1 ) { ContentValues initialValues = new ContentValues(); initialValues.put(GoodName, Quote); initialValues.put(CartID, Count1); return db.insert(DATABASE_TABLE, null, initialValues); }

    Read the article

  • Adding dynamic data to a table

    - by user559780
    I've the following table in my application. I've a ajax request which will fetch the results to be shown in the table. How add these results to the table with out overridding the header every time? <table id="itemList"> <td>Name</td> <td>Price</td> <td>Quantity</td> <td>Total</td> </table> Then the ajax data is as shown below var items = [ { Name: "Apple", Price: "80", Quantity : "3", Total : "240" }, { Name: "Orance", Price: "50", Quantity : "4", Total : "200" }, { Name: "Banana", Price: "20", Quantity : "8", Total : "160" }, { Name: "Cherry", Price: "250", Quantity : "10", Total : "2500" } ]; Now I'm trying something like this but it is not working var rows = ""; $.each(items, function(){ rows += "<tr><td>" + this.Name + "</td><td>" + this.Price + "</td><td>" + this.Quantity + "</td><td>" + this.Total + "</td></tr>"; }); $( "#itemList" ).text('<tr><td>Name</td><td>Price</td><td>Quantity-</td><td>Total</td></tr>' + rows );

    Read the article

  • Regular expression to match HTML table row ( <tr> ) NOT containing a specific value

    - by user1821136
    I'm using Notepad++ to clean up a long and messy HTML table. I'm trying to use regular expressions even if I'm a total noob. :) I need to remove all the table rows that doesn't contain a specific value (may I call that substring?). After having all the file contents unwrapped, I've been able to use the following regular expression to select, one by one, every table row with all its contents: <tr>.+?</tr> How can I improve the regular expression in order to select and replace only table rows containing, somewhere inside a part of them, that defined substring? I don't know if this does matter but the structure of every table row is the following (I've put there every HTML tag, the dots stand for standard content/values) <tr> <td> ... </td> <td> ... </td> <td> <a sfref="..." href="...">!! SUBSTRING I HAVE TO MATCH HERE !!</a> </td> <td> <img /> </td> <td> ... </td> <td> ... </td> <td> ... </td> <td> ... </td> </tr> Thanks in advance for your help!

    Read the article

  • UITableView performance degrading after adding subviews on cell iphone sdk

    - by neha
    Hi all, In my application, I'm adding a label and two buttons on cell of UItableView [I have not created a separate cell class]. I'm adding these to cell and not cell.contentview. After I run my application on IPhone, the tableview cell rendering after I move the cells up-down, is very jerky. Is it because I'm not adding the views on cell.contentView or because I've not created a custom class for cell? Can anybody please help? Thanks in advance.

    Read the article

  • How to select the specific cell in Jtable?

    - by Nitz
    Hey guys Now in my one jframe i have used two jtables with different data. But now what i want is..as soon as user select one cell on first table, then in second table, the cell next to selected cell of the first table should be selected. means.... if user had selected the cell which is on column - 3 and row - 1 [ first table cell position ] then next table should automatically select the cell at column - 4 and row - 1 [ second table cell position ] i know how to get the selected row and column of jtable but i don't know how to set Select on jtable.

    Read the article

  • To share a table or not share?

    - by acidzombie24
    Right now on my (beta) site i have a table called user data which stores name, hash(password), ipaddr, sessionkey, email and message number. Now i would like the user to have a profile description, signature, location (optional) and maybe other things. Should i have this in a separate mysql table? or should i share the table? and why?

    Read the article

  • PHP and MySQL echoing out a Table

    - by user1631702
    Okay, so I've done this before, and it worked. I am trying to echo out specific rows on my database in a table. Here is my code: <?php $connect = mysql_connect("localhost", "xxx", "xxx") or die ("Hey loser, check your server connection."); mysql_select_db("xxx"); $quey1="select * from `Ad Requests`"; $result=mysql_query($quey1) or die(mysql_error()); ?> <table border=1 style="background-color:#F0F8FF;" > <caption><EM>Student Record</EM></caption> <tr> <th>Student ID</th> <th>Student Name</th> <th>Class</th> </tr> <?php while($row=mysql_fetch_array($result)){ echo "</td><td>"; echo $row['id']; echo "</td><td>"; echo $row['twitter']; echo "</td><td>"; echo $row['why']; echo "</td></tr>"; } echo "</table>"; ?> It gives me no errors, but It just shows a blank table with none of these rows. My Question: How come this wont show any rows in the table, what am I doing wrong?

    Read the article

  • How to remove margin at top of table?

    - by George Edison
    I have the following HTML: <div></div> <table> <tr><td>Test</td></tr> </table> ...and the following CSS: div { /* nothing yet */ } table { margin: 0px; border-collapse: collapse; padding: 0px; } No matter what I do, there is still a gap between the table and the DIV. This occurs on Google Chrome 5.0.375.70 beta on Linux. (And it seems to occur on other Webkit-based browsers too.) How can I get rid of the space?

    Read the article

  • Grouped UITableView's cell separator missing when setting backgroundView with an image

    - by Howard Spear
    I have a grouped UITableView with a custom UITableViewCell class and I am adding a custom background image to each cell. However, when I do this, the cell's separator is not visible. If simply switch the table style to Plain instead of Grouped, the separator is showing up. I need the grouped table - how do I make the separator show up? Here's my code: @interface MyCustomTableViewCell : UITableViewCell @end @implementation MyCustomTableViewCell // because I'm loading the cell from a xib file - (id)initWithCoder:(NSCoder *)coder { self = [super initWithCoder:coder]; if (self) { // Create a background image view. self.backgroundView = [[UIImageView alloc] init]; } return self; } // MyViewController - (UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { // // standard cell dequeue + create cell code here // // // Configure the cell background now // UIImage *backgroundImage = [UIImage imageNamed:@"odd_row.png"]; if (indexPath.row % 2 == 0) { backgroundImage = [UIImage imageNamed:@"even_row.png"]; } UIImageView *backgroundView = (UIImageView *)cell.backgroundView; backgroundView.image = backgroundImage; }

    Read the article

  • jQuery table rebuild

    - by Happy
    We have a table: <table> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> <td>5</td> <td>6</td> <td>7</td> <td>8</td> <td>9</td> <td>10</td> </tr> </table> We update this table by throwing into each <tr> only 3 <td>. It must look like: <table> <tr> <td>1</td> <td>2</td> <td>3</td> </tr> <tr> <td>4</td> <td>5</td> <td>6</td> </tr> <tr> <td>7</td> <td>8</td> <td>9</td> </tr> <tr> <td>10</td> </tr> </table> How can we do this? Thanks.

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >