Can someone provide a code snippet or suggestions for the query above?
thanks,
User Profile
Collapse
-
Thanks, I was able to make the conversion from string to int. But my next question is how do I write the sql query to query the database to return the results using the new averages in which I converted to integers?
//newdailyCount is a string like "1.2222"
//firstAverage is an int
Code:firstAverage=Integer.parseInt(newdailyCount);
Leave a comment:
-
Thanks for the quick response, but how do I accomplish that? Can you provide a code snippet, or refer me to an article?Leave a comment:
-
Query to find the difference b/w averages
Hi,
I have wrote two queries, one to find the average for one date, and the second query to find the average for another date. And I stored the results of the query to a local string object. Is there anyway to compare the two averages by getting the difference between the two.
example query
Code:String myQuery = "" + "select name, age, date, avg(count) from product where date=interval
-
also you have to make sure that you are trying to run this command where your instance of MYSQL was installed
Ex. C:\MySQL Server 5.0\binLeave a comment:
-
Try this: mysql -h mysql.ecn.purdu e.edu -u hfh -p
//then when it prompts for password enter it in if applicableLeave a comment:
-
Also here is code snippet of jdbc prog
Code:String url = "jdbc:mysql://MyDriver/"; String dbName="product"; String driver="com.mysql.jdbc.Driver"; String username="root"; String password="password"; String myQuery="SELECT name, AVG(daily_typing_pages) FROM t1 WHERE work_date BETWEEN '2007-01-24' AND '2007-05-06'
Leave a comment:
-
I am using MYSQL version 5.0 and I am connecting to a table that was already created with the appropriate fields, and I am using JDBC to connect to the instance and tables which connects and works fine. The only problem is when I try and run the query is where I don't get any results.
Code:SELECT name, AVG(daily_typing_pages) FROM t1 WHERE work_date BETWEEN '2007-01-24' AND '2007-05-06' GROUP BY name
Leave a comment:
-
Thanks for the quick response,
Well its still not working for me, The field with the dates are of date type, do you think that's the problem? If so, how do I resolve the issue and return the query you have above?
Thanks,Leave a comment:
-
AVG between two dates
Hi,
I am trying to figure out how to find the avg in between two dates in the work_date field. For example, let's say I want the avg from 2007-01-24 to 2007-05-06, I would have to find the avg by taking the values in the daily_typing_pa ges columns and add up all the columns between the the dates provided. (E.G. (100+220+350+25 0+170)/5).
Code:+------+------+------------+--------------------+ | id | name | work_date |
-
-
My logic for the swap was to take the same approach I would take if I were using a bubblesort, create a temp value, select a specific row value, select another row value, then swap. The only difference b/w my approach and the bubble sort is I'm not trying to compare, just swap. I'm confused, can you help? I want to do something like this swap row value 1 with the last row value, then swap row value 2 with the second to last row value, etc.
...Leave a comment:
-
I had a mistake in my connection string, but I resolved it.
Code snippet
Code:connection.ConnectionString = "Data Source=" + this.textbox.Text +"; Network library=DBMSSOCN; Initial Catalog=" + this.combobox.SelectedItem +"; UID=" + this.namebox.Text +";PWD=" + this.box.Text;
Leave a comment:
-
Data manipulation in datagrid
Hi everyone,
i have a problem. I am working on a c# windows application that requires me to swap row values in a datagrid. Let's say for example, A column is with names is displayed in the datagrid, what I want to do is take row 1 (jack) and exchange it with row 15(paul) and exchange the values within the actual cells.
Here's what I tried:
Code:void swap_datagrid_values() { int ct;
-
Connection string in c# that accepts user input
nvm I think I figured out what the problem was -
encrypt any file type in c#
Hi, everyone
I'm developing a c# windows application that allows the user to encrypt any file type. i would like to encrypt the file using a powerful encrypting algorithm. I've tried to use the rinjael, triple des, but it doesn't seem to encrypt certain files at all. Can you please tell me what the problem is. I don't understand why this function doesn't work when I call it and encrypt the file. when I search for the file it still... -
Hi, Atran
I tried to declare the Datatable and the form globally so that I would be able to use it in my application to dynamically create and display the listbox. The problem i'm currently having is by doing so the tables are null, which means they don't return anything or have no value. I'm still having problems on the listbox1 doubleclick event. My application still doesn't display the 2nd listbox with the tables, my code just breaks at...Leave a comment:
-
Thanks for the help Atran. I have been working on this problem the past few days and I'm still stuck. I wrote a function that returns the datatable, but the problem is that I don't know what to write in my listbox double click event to load the tables.
Any Suggestions????
Here's what I have:
Code:private void button1_Click(object sender, EventArgs e) { get_db_tables(); }
Leave a comment:
-
Here's what I tried:
// Connection String to Excel Workbook
string excelConnection String = @"Provider=Micr osoft.Jet.OLEDB .4.0;Data Source=D:\Docum ents and Settings\saharr is\My Documents\first _last_name.xls; Extended Properties=""Ex cel 8.0;HDR=YES;""" ;
// Create Connection to Excel Workbook
using (OleDbConnectio n connection = new OleDbConnection (excelConnectio nString))...Leave a comment:
-
Inserting excel column into specific sql table column
Can someone please explain to me how to select a specific column in an excel spreadsheet and import the information in that column to an sql table in a c# windows application. Let's say my excel spreadsheet is full of first and last names and dates. What I want to do is take column "A" and insert the names in that column into an sql table with the column name "first_name ". And I want to do the same thing for the last name column...
No activity results to display
Show More
Leave a comment: