Search Results

Search found 12215 results on 489 pages for 'identity column'.

Page 113/489 | < Previous Page | 109 110 111 112 113 114 115 116 117 118 119 120  | Next Page >

  • Possible to not use ID field but another column name? in Lift

    - by bstevens90
    I am connected to a oracle database from a scala/lift webapp. I have been able to successfully pull information from the database as I wished but am having one issue. For each table I want to access I am required to add an ID field so that the app will work with the trait IdPK. What mapper class or trait can I use to override this? I have been trying to find one but been unable to locate it. Figured people have not always had an ID field on every table they make that is just called ID... class DN_REC extends LongKeyedMapper[DN_REC] with IdPK { def getSingleton = DN_REC object dn_rec_id extends MappedInt(this){ } This is what I am talking about. I would like to use the dn_rec_id as my primary key as it is on the table. Thanks

    Read the article

  • What can be inside a class that derive from OmniAuth?

    - by Richard77
    I have the following class class Identity < OmniAuth:: Identity:: Models:: ActiveRecord attr_accessible :email, :name, :password_digest, :password, :password_confirmation end I wonder if the above properties are the only ones allowed for a class that derive from a OmniAuth. I wish I could add some more like FirstName, LastName, age, gender, and so on. Do I need to create an other model for those properties or can I just add them to the Identity model? Thanks for helping.

    Read the article

  • How to handle the Date column of excel sheet in C# code?

    - by Lalit
    Hi I am reading the Excel sheet in c# using interop services. My excel sheet have the date columns of formate dd/mm/yyyy. while reading , runtime i am getting some different values for each cell as :38840,38808,39873...so n so... what does that mean? please help.How to handle the date columns of the excel sheet in C#. please guide me.

    Read the article

  • MySQL & NHibernate. How fix the error: Column 'ReservedWord' does not belong to table ReservedWords?

    - by Eduardo Xavier
    "I am getting a weird error when using NHibernate. And I don't know what is causing this error. I am new to the whole Visual Studio and NHibernate, but not to Hibernate. I used Hibernate in the past in Java projects. Any help would be appreciated in pointing me where my error is. I am using Visual Studio 2008 SP1 with Mysql 5.1. Below is the code I am using. " The full code and examples are posted here: https://forum.hibernate.org/viewtopic.php?f=25&t=997701

    Read the article

  • I want to exchange the Value of a column in two different rows in Microsoft SQL server

    - by Silmaril89
    Hi, I want to do the following two SQL Queries in Microsoft SQL SERVER UPDATE Partnerships SET sortOrder = 2 WHERE sortOrder = 1; UPDATE Partnerships SET sortOrder = 1 WHERE sortOrder = 2; The only problem is, I don't allow for sortOrder to contain the same value, it is a unique key. How could I get around this, because the first query violates the unique key rule and terminates? Or will I have to get rid of the unique key rule I have? Thanks!

    Read the article

  • updating a column in a table only if after the update it won't be negative and identifying all updat

    - by Azeem
    Hello all, I need some help with a SQL query. Here is what I need to do. I'm lost on a few aspects as outlined below. I've four relevant tables: Table A has the price per unit for all resources. I can look up the price using a resource id. Table B has the funds available to a given user. Table C has the resource production information for a given user (including the number of units to produce everyday). Table D has the number of units ever produced by any given user (can be identified by user id and resource id) Having said that, I need to run a batch job on a nightly basis to do the following: a. for all users, identify whether they have the funds needed to produce the number of resources specified in table C and deduct the funds if they are available from table B (calculating the cost using table A). b. start the process to produce resources and after the resource production is complete, update table D using values from table C after the resource product is complete. I figured the second part can be done by using an UPDATE with a subquery. However, I'm not sure how I should go about doing part a. I can only think of using a cursor to fetch each row, examine and update. Is there a single sql statement that will help me avoid having to process each row manually? Additionally, if any rows weren't updated, the part b. SQL should not produce resources for that user. Basically, I'm attempting to modify the sql being used for this logic that currently is in a stored procedure to something that will run a lot faster (and won't process each row separately). Please let me know any ideas and thoughts. Thanks! - Azeem

    Read the article

  • How do I sort an activerecord result set on a i18n translated column?

    - by PlanetMaster
    Hi, I have the following line in a view: <%= f.select(:province_id, options_from_collection_for_select(Province.find(:all, :conditions => { :country_id => @property.country_id }, :order => "provinces.name ASC"), :id, :name) %> In the province model I have the following: def name I18n.t(super) end Problem is that the :name field is translated (through the province model) and that the ordering is done by activerecord on the english name. The non-english result set can be wrongly sorted this way. We have a province in Belgium called 'Oost-Vlaanderen'. In english that is 'East-Flanders". Not good for sorting:) I need something like this, but it does not work: <%= f.select(:province_id, options_from_collection_for_select(Province.find(:all, :conditions => { :country_id => @property.country_id }, :order => "provinces.I18n.t(name) ASC"), :id, :name) %> What would be the best approach to solve this? As you may have noticed, my coding knowledge is very limited, sorry for that.

    Read the article

  • Can we use a sql data field as column name instead?

    - by Starx
    First a query SELECT * FROM mytable WHERE id='1' Gives me a certain number of rows For example id | context | cat | value 1 Context 1 1 value 1 1 Context 2 1 value 2 1 Context 1 2 value 3 1 Context 2 2 value 4 Now my problem instead of receiving the result in such way I want it is this way instead id | cat | Context 1 | Context 2 1 1 value 1 value 2 1 2 value 3 value 4

    Read the article

  • SQL query select from table and group on other column...

    - by scaryjones
    I'm phrasing the question title poorly as I'm not sure what to call what I'm trying to do but it really should be simple. I've a link / join table with two ID columns. I want to run a check before saving new rows to the table. The user can save attributes through a webpage but I need to check that the same combination doesn't exist before saving it. With one record it's easy as obviously you just check if that attributeId is already in the table, if it is don't allow them to save it again. However, if the user chooses a combination of that attribute and another one then they should be allowed to save it. Here's an image of what I mean: So if a user now tried to save an attribute with ID of 1 it will stop them, but I need it to also stop them if they tried ID's of 1, 10 so long as both 1 and 10 had the same productAttributeId. I'm confusing this in my explanation but I'm hoping the image will clarify what I need to do. This should be simple so I presume I'm missing something.

    Read the article

  • How do I escape reserved words used as column names? MySQL/Create Table

    - by acidzombie24
    I am generating tables from classes in .NET and one problem is a class may have a field name key which is a reserved MySQL keyword. How do I escape it in a create table statement? (Note: The other problem below is text must be a fixed size to be indexed/unique) create table if not exists misc_info ( id INTEGER PRIMARY KEY AUTO_INCREMENT NOT NULL, key TEXT UNIQUE NOT NULL, value TEXT NOT NULL)ENGINE=INNODB;

    Read the article

  • How can i add to dataGridView1 a data to the last row/column?

    - by user3681442
    In top of form1 i did: private System.Timers.Timer _refreshTimer; private int _thisProcess; Then in the Form1 Load event: _thisProcess = Process.GetCurrentProcess().Id; InitializeRefreshTimer(); PopulateApplications(); Then the timer init method: void InitializeRefreshTimer() { _refreshTimer = new System.Timers.Timer(5000); _refreshTimer.SynchronizingObject = this; _refreshTimer.Elapsed += new System.Timers.ElapsedEventHandler(TimerToUpdate_Elapsed); _refreshTimer.Start(); } Then the timer elapsed event: void TimerToUpdate_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { PopulateApplications(); } In the end the Populate method: void PopulateApplications() { dataGridView1.Rows.Clear(); foreach (Process p in Process.GetProcesses(".")) { if (p.Id != _thisProcess) { try { if (p.MainWindowTitle.Length > 0) { String status = p.Responding ? "Running" : "Not Responding"; dataGridView1.Rows.Add( p.MainWindowTitle, status); } } catch { } } } } The variable status show in the column2 but let's say i want that status will be display for each process/app in column5 ? How can i move it ? EDIT** Tried this: void PopulateApplications() { dataGridView1.Rows.Clear(); foreach (Process p in Process.GetProcesses(".")) { if (p.Id != _thisProcess) { try { if (p.MainWindowTitle.Length > 0) { var icon = Icon.ExtractAssociatedIcon(p.MainModule.FileName); Image ima = icon.ToBitmap(); img.Image = ima; img.HeaderText = "Image"; img.Name = "img"; String status = p.Responding ? "Running" : "Not Responding"; dataGridView1.Rows.Add(img, p.MainWindowTitle, status); } } catch { } } } } I moved the variable img to the top of the form. The problem is i see in each row this: DataGridViewImageColumn { Name=img, Index=-1 } And i don't see the icon it self. Why ?

    Read the article

  • How do I left pad a database column in FrontBase?

    - by PleaseStand
    I have a table of items (let's call it WIDGET) that each have their own eight-digit barcode numbers stored in a VARCHAR field (let's call it BARCODE; the table's primary key is in a separate integer field ID). My problem is that some personnel have omitted the leading zeros instead of entering the entire number while others have not. All new data is being entered with all eight digits present, but I would like to update all the existing records (several hundred in all) to eight digits for the sake of consistency. 1 → 00000001 234 → 00000234 5678 → 00005678 00009012 → 00009012 I know FrontBase supports all of SQL-92, but SQL-92 has no function specifically for left-padding strings. I already came up with a solution, but I am posting this question to see if anyone can think of a better way of doing this than I did.

    Read the article

  • How do i escape reserve names in a column? MySQL/Create Table

    - by acidzombie24
    I am generating tables from classes in .NET and one problem is a class may have a field name key which is a reserved mysql keyword. How do i escape it in a create table statement? (Note: The other problem below is text must be a fixed size to be indexed/unique) create table if not exists misc_info ( id INTEGER PRIMARY KEY AUTO_INCREMENT NOT NULL, key TEXT UNIQUE NOT NULL, value TEXT NOT NULL)ENGINE=INNODB;

    Read the article

  • CSS 3 columns, why is the third column taking over the other 2?

    - by Matt Dawdy
    Here is the smallest amount of code that clearly illustrates my problem: <html> <body> <div style="float: left; width: 200px;">One</div> <div style="float: left; width: 200px;">Two</div> <div style="background-color: #f0f;">Three</div> </body> </html> The first 2 divs are supposed to be 2 left columns. The 3rd should take up the rest of the page. Eventually, I'm going to add options to hide and show the 2 columns on the left. But, why is the color purple extending all the way to the browser's left edge? I am trying to get it to start at the word "Three".

    Read the article

  • How to get the default value of a column of MS Access Database using C++?

    - by user198750
    This is the sql script I used to create a table in MS Access Database. CREATE TABLE Contracts ( id int NULL DEFAULT 0, sex varchar(255) DEFAULT 'female' NOT NULL ) Now I want to programmatically get the default value of the field: "sex", I know it's 'female' but I don't know how to get it using C++ ADO interface. Below is a snippet of my code: m_pRecordset->Fields->get_Item(vIntegerType, &pvObject); bstrColName = pvObject->GetName(); dtype = pvObject->GetType(); attr = pvObject->GetAttributes();

    Read the article

  • How can I update a column in a table with the result of a select statement that uses row being updat

    - by Sailing Judo
    This SQL statement example is very close to what I think I need... update table1 set value1 = x.value1 from (select value1, code from table2 where code = something) as x However, what I need to do is change the "something" in the above example to a value from the row that is being updated. For example, I tried this but it didn't work: update table1 A set value1 = x.value1 from (select value1, code from table2 where code = A.something) as x This is a one time operation to update an existing table and I'm not really looking for high performance way to do this. Any solution that gets the task done is good enough.

    Read the article

  • Create macro to move data in a column UP?

    - by user1786695
    I have an excel sheet of which the data was jumbled: for example, the data that should have been in Columns AB and AC were instead in Columns B and C, but on the row after. I have the following written which moved the data from B and C to AB and AC respectively: Dim rCell As Range Dim rRng As Range Set rRng = Sheet1.Range("A:A") i = 1 lastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row For Each rCell In rRng.Cells If rCell.Value = "" Then Range("AB" & i) = rCell.Offset(0, 1).Value rCell.Offset(0, 1).ClearContents End If i = i + 1 If i = lastRow + 1 Then Exit Sub End If Next rCell End Sub However, it doesn't fix the problem of the data being on the row BELOW the appropriate row now that they are in the right columns. I am new to VBA Macros so I would appreciate any help to make the data now align. I tried toggling the Offset parameter (-1,0) but it's not working.

    Read the article

< Previous Page | 109 110 111 112 113 114 115 116 117 118 119 120  | Next Page >