Search Results

Search found 28627 results on 1146 pages for 'case statement'.

Page 31/1146 | < Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >

  • WM_CONCAT use CASE

    - by Ruslan
    i have a select: select substr(acc,1,4),currency, amount, module, count(*), wm_concat(trn_ref_no) trn from all_entries where date = to_date ('01012010','DDMMYYYY') group by substr(acc,1,4),currency, amount, module in this case i have error: *ORA-06502: PL/SQL: : character string buffer too small ... "WMSYS.WM_CONCAT_IMPL"* if i change to: select substr(acc,1,4),currency, amount, module, count(), (case when count() < 10 then wm_concat(trn_ref_no) else null end) trn from fcc.acvw_all_ac_entries where trn_dt = to_date ('05052010','DDMMYYYY') group by substr(acc,1,4),currency, amount, module to avoid buffer limit error. But even in this case i have the same error. How can i avoid this error?

    Read the article

  • PHP 5.2.12 - Interesting Switch Statement Bug With Integers and Strings

    - by Levi Hackwith
    <?php $var = 0; switch($var) { case "a": echo "I think var is a"; break; case "b": echo "I think var is b"; break; case "c": echo "I think var is c"; break; default: echo "I know var is $var"; break; } ?> Maybe someone else will find this fascinating and have an answer. If you run this, it outputs I think the var is a when clearly it's 0. Now, I'm most certain this has something to do with the fact that we're using strings in our switch statement but the variable we're checking is an integer. Does anyone know why PHP behaves this way? It's nothing too major, but it did give me a bit of a headache today. Thanks folks!

    Read the article

  • Scala case class generated field value

    - by Petteri Hietavirta
    I have an existing Scala application and it uses case classes which are then persisted in MongoDB. I need to introduce a new field to a case class but the value of it is derived from existing field. For example, there is phone number and I want to add normalised phone number while keeping the original phone number. I'll update the existing records in MongoDB but I would need to add this normalisation feature to existing save and update code. So, is there any nice shortcut in Scala to add a "hook" to a certain field of a case class? For example, in Java one could modify setter of the phone number.

    Read the article

  • Enums,use in switch case

    - by WPS
    Hi, I have an Enum defined which contains method return type like "String",Float,List,Double etc. I will be using it in switch case statements. For example my enum is public enum MethodType { DOUBLE,LIST,STRING,ARRAYLIST,FLOAT,LONG; } In a property file, I've key value pairs as follows. Test1=String Test2=Double In my code I'm getting the value for the key. I need to use the VALUE in Switch Case to Determine the Type and based on that I've to implement some logic. For example something like this switch(MethodType.DOUBLE){ case DOUBLE: //Dobule logic } Can someone please help me to implement this?

    Read the article

  • Unreachable code detected in case statement

    - by alex
    I have a code: protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { switch (keyData) { case Keys.Alt|Keys.D1: if (this._condition1) { return true; } else { return base.ProcessCmdKey(ref msg, keyData); } break; case Keys.Control |Keys.U: if (this._condition2) { return true; } else { return base.ProcessCmdKey(ref msg, keyData); } break; default: return base.ProcessCmdKey(ref msg, keyData); } return true; It gives me "unreachable code detected" warning on breaks. Is it good practice not to use break operator here ? I don't want to turn off "unreachable code detected" warning. PS: There are many case in my ProcessCmdKey method.

    Read the article

  • Java: Switch statements with methods involving arrays

    - by Shane
    Hi guys I'm currently creating a program that allows the user to create an array, search an array and delete an element from an array. Looking at the LibraryMenu Method, the first case where you create an array in the switch statement works fine, however the other ones create a "cannot find symbol error" when I try to compile. My question is I want the search and delete functions to refer to the first switch case - the create Library array. Any help is appreciated, even if its likely from a simple mistake. import java.util.*; public class EnterLibrary { public static void LibraryMenu() { java.util.Scanner scannerObject =new java.util.Scanner(System.in); LibraryMenu Menu = new LibraryMenu(); Menu.displayMenu(); switch (scannerObject.nextInt() ) { case '1': { System.out.println ("1 - Add Videos"); Library[] newLibrary; newLibrary = createLibrary(); } break; case '2': System.out.println ("2 - Search Videos"); searchLibrary(newLibrary); break; case '3': { System.out.println ("3 - Change Videos"); //Change video method TBA } break; case '4': System.out.println ("4 - Delete Videos"); deleteVideo(newLibrary); break; default: System.out.println ("Unrecognized option - please select options 1-3 "); break; } } public static Library[] createLibrary() { Library[] videos = new Library[4]; java.util.Scanner scannerObject =new java.util.Scanner(System.in); for (int i = 0; i < videos.length; i++) { //User enters values into set methods in Library class System.out.print("Enter video number: " + (i+1) + "\n"); String number = scannerObject.nextLine(); System.out.print("Enter video title: " + (i+1) + "\n"); String title = scannerObject.nextLine(); System.out.print("Enter video publisher: " + (i+1) + "\n"); String publisher = scannerObject.nextLine(); System.out.print("Enter video duration: " + (i+1) + "\n"); String duration = scannerObject.nextLine(); System.out.print("Enter video date: " + (i+1) + "\n"); String date= scannerObject.nextLine(); System.out.print("VIDEO " + (i+1) + " ENTRY ADDED " + "\n \n"); //Initialize arrays videos[i] = new Library (); videos[i].setVideo( number, title, publisher, duration, date ); } return videos; } public static void printVidLibrary( Library[] videos) { //Get methods to print results System.out.print("\n======VIDEO CATALOGUE====== \n"); for (int i = 0; i < videos.length; i++) { System.out.print("Video number " + (i+1) + ": \n" + videos[i].getNumber() + "\n "); System.out.print("Video title " + (i+1) + ": \n" + videos[i].getTitle() + "\n "); System.out.print("Video publisher " + (i+1) + ": \n" + videos[i].getPublisher() + "\n "); System.out.print("Video duration " + (i+1) + ": \n" + videos[i].getDuration() + "\n "); System.out.print("Video date " + (i+1) + ": \n" + videos[i].getDate() + "\n "); } } public static Library searchLibrary( Library[] videos) { //User enters values to setSearch Library titleResult = new Library(); java.util.Scanner scannerObject =new java.util.Scanner(System.in); for (int n = 0; n < videos.length; n++) { System.out.println("Search for video number:\n"); String newSearch = scannerObject.nextLine(); titleResult.getSearch( videos, newSearch); if (!titleResult.equals(-1)) { System.out.print("Match found!\n" + newSearch + "\n"); } else if (titleResult.equals(-1)) { System.out.print("Sorry, no matches found!\n"); } } return titleResult; } public static void deleteVideo( Library[] videos) { Library titleResult = new Library(); java.util.Scanner scannerObject =new java.util.Scanner(System.in); for (int n = 0; n < videos.length; n++) { System.out.println("Search for video number:\n"); String deleteSearch = scannerObject.nextLine(); titleResult.deleteVideo(videos, deleteSearch); System.out.print("Video deleted\n"); } } public static void main(String[] args) { Library[] newLibrary; new LibraryMenu(); } }

    Read the article

  • Psycopg2 doesn't like table names that start with a lower case letter

    - by Count Boxer
    I am running ActiveState's ActivePython 2.6.5.12 and PostgreSQL 9.0 Beta 1 under Windows XP. If I create a table with an upper case first letter (i.e. Books), psycopg2 returns the "Programming Error: relation "books" does not exist" error message when I run the select statement: execute("SELECT * FROM Books"). The same error is returned if I run: execute("SELECT * FROM books"). However, if I change the table to a lower case first name (i.e. books), then either of the above statements works. Are tables name supposed to have a lower case first name? Is this a setting or a feature or a bug? Am I missing something obvious?

    Read the article

  • ASP, My SQL & case sensitity suddenly broken

    - by user131812
    Hi There, We have an old ASPsite that has been working fine for years with a MY SQL database. All of a sudden last week lots fo SQL queries stopped working. The database has a table called 'members' but the code calls 'Members'. It appears the queries used to work regardless of case sensitivity on the table names, but something has changed recently somewhere to enforce case. This has me stumped as the site has not been touched in years, the server config hasn't changed & the database provide has not changed anything. Is there any simple way to ignore case for an ASP site (without editing lots fo files :) Thanks Ben

    Read the article

  • Programmatically get valid switch/case values

    - by craigim
    When MATLAB scans through cases in a switch/case block, does it remember the values that it skips, and is it possible to access that list? I have a few functions with long switch\case block and I would like to have them return a list of valid case values if they make it down to otherwise. For instance, I have a function that returns a set of optical constants for a material. It currently has about 20 different materials and it is growing as I consider new ones. I realize I can brute-force it and just re-type all of the valid cases into a cell array under otherwise and have the function throw an error and return the list of valid responses, but maintaining both lists without errors or laziness creeping in over time is challenging.

    Read the article

  • Simplifying CASE WHEN SQL statement

    - by kateroh
    Im trying to improve the following CASE statement to calculate the difference only once. I do it to avoid negative numbers: SELECT (CASE WHEN ((SELECT 100 - (SELECT COUNT(CustomerId) FROM Customers)) > 0) THEN (SELECT 100 - (SELECT COUNT(CustomerId) FROM Customers)) ELSE (0) END) This not only looks stupid, but also is not thread-safe. I tried the following, but I get an error message "Invalid column name 'diff'." SELECT (CASE WHEN ((SELECT 100 - (SELECT COUNT(CustomerId) FROM Customers) as diff) > 0) THEN (diff) ELSE (0) END) How can this be simplified? Is there an in-built SQL function that already does this job? EDIT: Sorry, forgot to mention that the select statement is inside of a view declaration, so I cant declare variables.

    Read the article

  • Cron won't use msmtp to send emails in case of failed cronjob

    - by Glister
    I'm trying to configure a machine so that it will send me an email if one of the cronjobs output something in case of an error. I'm using Debian Wheezy. Cron is working normally (without the email functionality). msmtp is installed and configured. Have already symlinked /usr/{bin|sbin}/sendmail to /usr/bin/msmtp. I can send email by using: echo "test" | mail -s "subject" [email protected] or by executing: echo "test" | /usr/sbin/sendmail Without the symlink (/usr/sbin/sendmail) cron will tell me that: (CRON) info (No MTA installed, discarding output) With the symlinks I get: (root) MAIL (mailed 1 byte of output; but got status 0x004e, #012) Can you suggest how to config the cron/msmtp pair? Thanks! EDIT: Note: I've written "msmtpd" by mistake. Its not a daemon but rather an SMTP client named just "msmtp" (without the "d" ending). It is executed on demand and it is not running in the background all the time. When I try to send an email by using msmtp like that it works: echo "test" | msmtp [email protected] On the far side, in the logs of the SMTP server I read: Nov 2 09:26:10 S01 postfix/smtpd[12728]: connect from unknown[CLIENT_IP] Nov 2 09:26:12 S01 postfix/smtpd[12728]: 532301C318: client=unknown[CLIENT_IP], sasl_method=CRAM-MD5, [email protected] Nov 2 09:26:12 S01 postfix/cleanup[12733]: 532301C318: message-id=<> Nov 2 09:26:12 S01 postfix/qmgr[2404]: 532301C318: from=<[email protected]>, size=191, nrcpt=1 (queue active) Nov 2 09:26:12 S01 postfix/local[12734]: 532301C318: to=<[email protected]>, orig_to=<[email protected]>, relay=local, delay=0.62, delays=0.59/0.01/0/0.03, dsn=2.0.0, status=sent (delivered to command: IFS=' ' && exec /usr/bin/procmail -f- || exit 75 #1001) Nov 2 09:26:12 S01 postfix/qmgr[2404]: 532301C318: removed Nov 2 09:26:13 S01 postfix/smtpd[12728]: disconnect from unknown[CLIENT_IP] And the Email is delivered to the target user. So it looks like that the msmtp client is working properly. It has to be something in the cron/msmtp integration, but I have no clue what that thing might be. Can you help me?

    Read the article

  • Truecrypt files corrupted after moving PC into another case

    - by Dygerati
    I recently bought a new PC case and transferred all of my PC hardware into it. The only hardware modification was the addition of two identical ram modules. The entire process went smoothly, and everything worked and booted as before. The only side-effect I found when accessing one my of file-based hidden truecrypt volumes shortly there after. Some of the files in the volume - NOT all - seemed to be entirely corrupted. The directory and file names are garbled characters, but a few of the directories in the same volume appear and function normally. Also, all files in the non-hidden tc volume were still intact. Is this not weird? The only other real change I could think of would be that the hard drives were connected to different SATA ports on the mobo. I really don't know how the truecrypt encryption works well enough to know what could cause this...and the fact that not all the files were corrupted makes it more bizarre still. So, first off (and I'm not too hopeful on this point), would it be possible to restore these files? I had a backup of most, but not all of the files involved. Other than that I'm just curious how this happened and how I can prevent it next time. Thanks!

    Read the article

  • Exchange 2003 - The Case of the Disappearing Message

    - by John Gardeniers
    We run a single Exchange 2003 Standard server. On two separate occasions we have had the following happen, both times with the same sender and recipients. A user with an an email address in domain A sends a message to two others with email addresses in domain B. I must stress that this is all internal and on the same Exchange server. Both recipients were listed in the "to" field. The first listed recipient received the message, the other didn't. Checking message tracking in ESM, as well as manually checking the server Application event log, indicates that both messages were delivered without a hitch. However, the message just cannot be found in the second recipient's mailbox. Using both Outlook and OWA I have searched all the recipient's Outlook folders, in case it accidentally got moved to another folder or was deleted. I also checked the deleted message recovery folder. No sign of it anywhere. I'm completely baffled. How could a message that the system insists was delivered not actually be in the recipient's mailbox? What else can I do to try and track it down?

    Read the article

  • Search Complexity of a Hashtable within a Hashtable?

    - by spacker_lechuck
    Say we have a hashtable of size m, and at each bucket we store a hashtable of size p. What would the worst case/average case search complexity be? I am inclined to say that since computing a hash function is still atomic, the only worst case scenario is if the value is at the end of the linked list in the hashtable of size p, so O(n)? I have no idea how to calculate the average case for this scenario and would appreciate any pointers!

    Read the article

  • The counter doesnt seem to increase when ever the edittext changes

    - by Mabulhuda
    Im using Edit-texts and i need when ever an edit-text is changed to increment a counter by one but the counter isnt working , I mean the app starts and everything but the counter doesnt seem to change please help here is the code public class Numersys extends Activity implements TextWatcher { EditText mark1 ,mark2, mark3,mark4,mark5,mark6 , hr1 ,hr2,hr3,hr4,hr5,hr6; EditText passed, currentavg; TextView tvnewavg ; Button calculate; double marks , curAVG , NewAVG ; String newCumAVG; int counter , hrs , curHr , NewHr; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.numersys); mark1=(EditText)findViewById(R.id.mark1n); mark2=(EditText)findViewById(R.id.mark2n); mark3=(EditText)findViewById(R.id.mark3n); mark4=(EditText)findViewById(R.id.mark4n); mark5=(EditText)findViewById(R.id.mark5n); mark6=(EditText)findViewById(R.id.mark6n); hr1=(EditText)findViewById(R.id.ethour1); hr2=(EditText)findViewById(R.id.ethour2); hr3=(EditText)findViewById(R.id.ethour3); hr4=(EditText)findViewById(R.id.ethour4); hr5=(EditText)findViewById(R.id.ethour5); hr6=(EditText)findViewById(R.id.ethour6); passed=(EditText)findViewById(R.id.etPassCn); currentavg=(EditText)findViewById(R.id.etCavgn); tvnewavg=(TextView)findViewById(R.id.tvcAVGn); mark1.addTextChangedListener(this); mark2.addTextChangedListener(this); mark3.addTextChangedListener(this); mark4.addTextChangedListener(this); mark5.addTextChangedListener(this); mark6.addTextChangedListener(this); calculate=(Button)findViewById(R.id.bAvgCalcn); @Override public void onClick(View arg0) { // TODO Auto-generated method stub switch(arg0.getId()) { case 0: break; case 1: hrs=Integer.valueOf(hr1.getText().toString()); marks=Double.valueOf(mark1.getText().toString())*Integer.valueOf(hr1.getText().toString()); curHr=Integer.valueOf(passed.getText().toString()); curAVG=Double.valueOf(currentavg.getText().toString())*curHr; NewHr= curHr+hrs; NewAVG= (marks+curAVG)/NewHr; break; case 2: hrs=Integer.valueOf(hr1.getText().toString())+Integer.valueOf(hr2.getText().toString()); marks=Double.valueOf(mark1.getText().toString())*Integer.valueOf(hr1.getText().toString()) +Double.valueOf(mark2.getText().toString())*Integer.valueOf(hr2.getText().toString()); curHr=Integer.valueOf(passed.getText().toString()); curAVG=Double.valueOf(currentavg.getText().toString())*curHr; NewHr= curHr+hrs; NewAVG= (marks+curAVG)/NewHr; break; case 3: hrs=Integer.valueOf(hr1.getText().toString())+Integer.valueOf(hr2.getText().toString()) +Integer.valueOf(hr3.getText().toString()); marks=Double.valueOf(mark1.getText().toString())*Integer.valueOf(hr1.getText().toString()) +Double.valueOf(mark2.getText().toString())*Integer.valueOf(hr2.getText().toString()) +Double.valueOf(mark3.getText().toString())*Integer.valueOf(hr3.getText().toString()); curHr=Integer.valueOf(passed.getText().toString()); curAVG=Double.valueOf(currentavg.getText().toString())*curHr; NewHr= curHr+hrs; NewAVG= (marks+curAVG)/NewHr; break; case R.id.bAvgCalcn: newCumAVG=String.valueOf(NewAVG); tvnewavg.setText(newCumAVG); } } }); } @Override public void afterTextChanged(Editable arg0) { // TODO Auto-generated method stub } @Override public void beforeTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { // TODO Auto-generated method stub } @Override public void onTextChanged(CharSequence arg0, int arg1, int arg2, int arg3) { // TODO Auto-generated method stub if(mark1.hasFocus()) { counter = counter+1; } if(mark2.hasFocus()) { counter = counter+1; } if(mark3.hasFocus()) { counter = counter+1; } if(mark4.hasFocus()) { counter = counter+1; } if(mark5.hasFocus()) { counter = counter+1; } if(mark6.hasFocus()) { counter = counter+1; } }

    Read the article

  • Using IF statements to find string length in array for alignment (Visual Basic)

    - by Brodoin
    My question is just as it says in the title. How would one use IF statements to find the string-length of content in an array, and then make it so that they show up in a Rich Text Box with the left sides aligned? Noting that one value in my array is a Decimal. Imports System.IO Imports System.Convert Public Class frmAll 'Declare Streamreader Private objReader As StreamReader 'Declare arrays to hold the information Private strNumber(24) As String Private strName(24) As String Private strSize(24) As String Private decCost(24) As Integer Private Sub frmAll_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Set objReader objReader = New StreamReader("products.csv") 'Call the FillArray sub to fill the array Call FillArray() End Sub Private Sub FillArray() 'Declare variables and arrays Dim decCost(24, 1) As Decimal Dim strFields() As String Dim strRec As String Dim intCount As Integer = 0 Dim chrdelim As Char = ToChar(",") 'Set strRec to read the lines strRec = objReader.ReadLine 'Do while loop to fill array. Do While strRec <> Nothing strFields = strRec.Split(chrdelim) strNumber(intCount) = strFields(0) strName(intCount) = strFields(1) strSize(intCount) = strFields(2) decCost(intCount, 0) = ToDecimal(strFields(3)) decCost(intCount, 1) = ToDecimal(strFields(4)) 'Set strRec to read the lines again strRec = objReader.ReadLine 'increment the index intCount += 1 Loop 'Call the Calculate sub for calculation Call Calculate(decCost) End Sub Private Sub Calculate(ByVal numIn(,) As Decimal) 'Define arrays to hold total cost Dim decRowTotal(24) As Decimal 'Define variables to hold the counters for rows and columns Dim intR As Integer Dim intC As Integer 'Calcualte total cost For intC = 0 To 1 For intR = 0 To 24 decRowTotal(intR) += numIn(intR, intC) * 1 Next Next 'Call the Output sub to configure the output. Call Output(numIn, decRowTotal) End Sub Private Sub Output(ByVal NumIn(,) As Decimal, _ ByVal RowTotalIn() As Decimal) 'Variables Dim strOut As String Dim intR As Integer = 0 Dim intC As Integer = 0 'Set header for output. strOut = "ID" & vbTab & "Item" & vbTab & vbTab & vbTab & "Size" & _ vbTab & vbTab & vbTab & vbTab & "Total Price" & _ vbCrLf & "---------- ... -------------------------" & vbCrLf 'For loop to add each line to strOut, setting 'the RowTotalIn to currency. For intC = 0 To 24 strOut &= strNumber(intC) & vbTab strOut &= strName(intC) & vbTab strOut &= strSize(intC) & vbTab strOut &= RowTotalIn(intC).ToString("c") & vbCrLf Next 'Add strOut to rbtAll rtbAll.Text = strOut End Sub End Class Output It shows up with vbTabs in my output, but still, it looks similar in that they are not aligned. The first two do, but after that they are not, and I am totally lost. P0001 Coffee - Colombian Supreme 24/Case: Pre-Ground 1.75 Oz Bags $16.50 P0002 Coffee - Hazelnut 24/Case: Pre-Ground 1.75 Oz Bags $24.00 P0003 Coffee - Mild Blend 24/Case: Pre-Ground 1.75 Oz Bags $20.50 P0004 Coffee - Assorted Flavors 18/Case. Pre-Ground 1.75 Oz Bags $23.50 P0005 Coffee - Decaf 24/Case: Pre-Ground 1.75 Oz Bags $20.50

    Read the article

  • PHP PDO Related: Update SQL Statement not Updating the content of Database

    - by Rachel
    I am trying to implement update statement using prepared statement in php script but it appears that it is not update record in the database and am not sure why and so would appreciate if you can share some insights. Code $query = "UPDATE DatTable SET DF_PARTY_ID = :party_id, DF_PARTY_CODE = :party_code, DF_CONNECTION_ID = :connection_id WHERE DF_PARTY_ID = ':party_id'"; $stmt = $this->connection->prepare($query); $stmt->bindValue(':party_id', $data[0], PDO::PARAM_INT); $stmt->bindValue(':party_code', $data[1], PDO::PARAM_INT); $stmt->bindValue(':connection_id', $data[2], PDO::PARAM_INT); $stmt->execute(); Inspiring Solution leading to this approach. Any Suggestions ?

    Read the article

  • SQL server recursive query error.The maximum recursion 100 has been exhausted before statement completion

    - by ienax_ridens
    I have a recursive query that returns an error when I run it; in other databases (with more data) I have not the problem. In my case this query returns 2 colums (ID_PARENT and ID_CHILD) doing a recursion because my tree can have more than one level, bit I wanna have only "direct" parent. NOTE: I tried to put OPTION (MAXRECURSION 0) at the end of the query, but with no luck. The following query is only a part of the entire query, I tried to put OPTION only at the end of the "big query" having a continous running query, but no errors displayed. Error have in SQL Server: "The statement terminated.The maximum recursion 100 has been exhausted before statement completion" The query is the following: WITH q AS (SELECT ID_ITEM, ID_ITEM AS ID_ITEM_ANCESTOR FROM ITEMS_TABLE i JOIN ITEMS_TYPES_TABLE itt ON itt.ID_ITEM_TYPE = i.ID_ITEM_TYPE UNION ALL SELECT i.ID_ITEM, q.ID_ITEM_ANCESTOR FROM q JOIN ITEMS_TABLE i ON i.ID_ITEM_PADRE = q.ID_ITEM JOIN ITEMS_TYPES_TABLE itt ON itt.ID_ITEM_TYPE = i.ID_ITEM_TYPE) SELECT ID_ITEM AS ID_CHILD, ID_ITEM_ANCESTOR AS ID_PARENT FROM q I need a suggestion to re-write this query to avoid the error of recursion and see the data, that are few.

    Read the article

  • Can a DevExpress XtraGrid be filled using a a Dynamic SELECT statement string

    - by Gerhard Weiss
    Can a DevExpress XtraGrid be filled using a a Dynamic SELECT statement string? i.e. SELECT * FROM Employee or SELECT * FROM Dependents To fill our XtraGrids currently, we use a ORM that creates entities. To do this it takes a lot of steps and time. What is driving me to ask this question is we do a lot of client aquistions where we get hundreds of files. I do not want to create entities for all of these then have to create an XtraGrid for each entity. Ideally if I can just feed it a SELECT statement and the XtraGrid could render it then I could use the XtraGrid very nice data minipulation features (Filter, Group By, etc). If you have any other ideas or suggestions please to not hesitate to post them.

    Read the article

  • MS Access 2003 - VBA for altering a table after a "SELECT * INTO tblTemp FROM tblMain" statement

    - by Justin
    Hi. I use functions like the following to make temporary tables out of crosstabs queries. Function SQL_Tester() Dim sql As String If DCount("*", "MSysObjects", "[Name]='tblTemp'") Then DoCmd.DeleteObject acTable, "tblTemp" End If sql = "SELECT * INTO tblTemp from TblMain;" Debug.Print (sql) Set db = CurrentDb db.Execute (sql) End Function I do this so that I can then use more vba to take the temporary table to excel, use some of excel functionality (formulas and such) and then return the values to the original table (tblMain). Simple spot i am getting tripped up is that after the Select INTO statement I need to add a brand new additional column to that temporary table and I do not know how to do this: sql = "Create Table..." is like the only way i know how to do this and of course this doesn't work to well with the above approach because I can't create a table that has already been created after the fact, and I cannot create it before because the SELECT INTO statement approach will return a "table already exists" message. Any help? thanks guys!

    Read the article

  • Dynamic case statement in bash

    - by infra.user
    Hi folks, I'm trying to figure out how to create a dynamic case statement in a bash script. For example, let's say I have the output of an awk statement with the following contents red green blue In this scenario, the output can change at any time. I'm trying to then execute different logic if a value is included in this awk output. So if the data above is in $list, then I'd conceptually like to do something like: case "${my_var}" in $list) ..... something_else) ..... esac I'm trying to use this to build a dynamic custom tab completion function (see http://www.debian-administration.org/article/An_introduction_to_bash_completion_part_2 for some background). Any ideas? Thanks.

    Read the article

  • SQL select statement with increment

    - by Matt
    Currently I'm using a for statement in PHP to get all the months for this SQL statement, but would like to know if I can do it all with SQL. Basically I have to get the average listing price, and the average selling price for each month going back 1 year where the sellingdate = the month. simple with PHP, but that creates 12 database hits. I'm trying the sql statment below, but it returns listings totally out of order SELECT avg(ListingPrice), avg(SellingPrice), count(ListingDate), DATE(SellingDate) as date, MONTH(SellingDate) as month, YEAR(SellingDate) as year FROM `rets_property_resi` WHERE Area = '5030' AND Status = 'S' AND SellingDate Output: 867507.142857 877632.492063 63 1996-12-24 12 1996 971355.833333 981533.333333 60 1997-11-18 11 1997 949334.328358 985453.731343 67 1997-10-23 10 1997 794150.000000 806642.857143 70 1996-09-20 9 1996 968371.621622 988074.702703 74 1997-08-21 8 1997 1033413.366337 1053018.534653 101 1997-07-30 7 1997 936115.054795 962787.671233 73 1996-06-07 6 1996 875378.735632 906921.839080 87 1996-05-16 5 1996 926635.616438 958561.643836 73 2010-04-13 4 2010 1030224.472222 1046332.291667 72 2010-03-31 3 2010 921711.458333 924177.083333 48 1997-02-28 2 1997 799484.615385 791551.282051 39 1997-01-15 1 1997 As you can see, it pulls from random dates, I need to to pull from 2010-03, 2010-02, 2010-01, etc... any help is appreciated!

    Read the article

  • Converting SQL statement into Linq

    - by DMan
    I'm trying to convert the following to a LINQ to SQL statement in C#. Can anyone give me a hand? Basically my table keeps record of all history of changes such that the created date max date for each seedlot is the most recent record and the correct one to show. SELECT reports.* FROM [dbo].[Reports] reports WHERE reports.createdDate IN ( SELECT MAX(report_max_dates.createdDate) FROM [dbo].[Reports] report_max_dates GROUP BY report_max_dates.Lot ) So far this is what I have. var result = (from report in db.Reports where report.createdDate == (from report_max in db.Reports group report_max by report_max.Lot into report_max_grouped select report_max_grouped).Max() select report); I can't figure out how to get the MAX dates for all reports and how to do an IN statement on the report.createdDate. Thansk, Dman

    Read the article

  • Problem with a SQL statement

    - by benwad
    I'm trying to enter values into a database table using a form and a PHP function. The PHP seems to be fine as the SQL statement it creates looks okay, but the database always throws up an error. This is the SQL statement that my code has generated (with arbitrary values): INSERT INTO Iteminfo ('itemName', 'itemSeller', 'itemCategory', 'itemDescription', 'itemPrice', 'itemPostage', 'itemBegin', 'itemEnd', 'buynow', 'itemPicture') values ('gorillaz album', 'ben', 'music', 'new one ', '5.00', '1.00', '2010-03-15 14:59:51', '2010-03-16 14:59:51', '0', 'http://www.thefader.com/wp-content/uploads/2010/01/gorillaz-plastic-beach.jpg') This throws up an error both when I use the PHP function to evaluate the query and also when I use phpMyAdmin to enter the query manually. However, I can't see anything wrong with it. Can anyone shed some light on this? All of the fields are VARCHAR values, except for itemPrice and itemPostage (which are stored as DECIMAL(4,2)) and the itemBegin and itemEnd, which are stored as DATETIMEs.

    Read the article

< Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >