StephNicolaou 32 Posting Whiz in Training

No, if the recipient doesn't have SQL Server Management Studio, he/she will need a program to open the file. Either ssms.exe or sqlwb.exe.

StephNicolaou 32 Posting Whiz in Training

All,

Is it at all possible to have a 'multiple items' form based on a query, plus have a combo box added to it, with the control source of a field already on the form.

Issues:

  1. When the combo box is given the control source of a field already on the multiple item form, the combo box can no longer be updated.

  2. When the combo box is not given the control source, it can be updated but then it does not load the initial value of the control source field.

Major issue:

  1. When the combo box is updated for a record on the multiple item form, it then updates all of the other combo boxes for each record.

I've been working with Access for quite a long time and always put it down to Access not being powerful enough, whereas I could do this in Java in a few minutes.

Hope someone has an answer to this odd one.

Steph

StephNicolaou 32 Posting Whiz in Training

Yes, this is possible.

To select a range of rows, you use the LIMIT element.

E.G. SELECT * FROM tbl LIMIT 5,10; # Retrieve rows 6-15

"With two arguments, the first argument specifies the offset of the first row to return, and the second specifies the MAXIMUM number of rows to return. The offset of the initial row is 0 (not 1)" - MySQL

http://dev.mysql.com/doc/refman/5.5/en/select.html

To insert these rows into another table you use the INTO element.

E.G. INTO TABLE (COLUMN)

-http://stackoverflow.com/questions/6194037/mysql-insert-without-having-to-specify-every-non-default-field-1067-invalid

Altogether you should have something like this:

SELECT lab_name INTO TBL(AM) FROM tbl LIMIT 0,5; //Gets first 5 
SELECT lab_name INTO TBL(PM) FROM tbl LIMIT 5,5; //Gets from record 6 to next 5

Hope that helps :)

Alternative methods & resources:

http://www.ntchosting.com/mysql/insert-data-into-table.html
http://dev.mysql.com/doc/refman/5.0/en/select-into.html

StephNicolaou 32 Posting Whiz in Training

Yes, you do not *have* to include the username or password.

I'm not sure if you are familiar with the database connection syntax, but you can just exclude the username and password variables from the connection string.

E.g. http://www.java-samples.com/showtutorial.php?tutorialid=9

There are alternative methods such as the grant element to allow public access but I would advise you use the standard method of connecting to a mysql database, there are numerous online tutorials where you can just exclude the usrname & pw. I haven't personally tried this as I wouldn't advise you not to use a usrname & pw in the first place.

However, even if you do include the root username and password for the mysql database in your program, the users do not see this anyway. So either way, you can successfully set up a connection to the database from all computers.

Hope that helps :)

StephNicolaou 32 Posting Whiz in Training

Student_ID is not a string, could you change line 9 to:

pst.setInt(1, txtid.getInt());

Yes, you can usually execute to different prepared statements.

Hope that helps :)

StephNicolaou 32 Posting Whiz in Training

No problem. Could you please mark this thread as solved if done so?

Thanks :)

StephNicolaou 32 Posting Whiz in Training

Are you able to move line 47 where you are doing this to line 16 and just make the frame visible when the button is hit instead?

Could you also inform us of the error message you're receiving?

Thanks :)

StephNicolaou 32 Posting Whiz in Training

Try this with variables defined and without the getbytes method for now:

try {             
     InetAddress adr = InetAddress.getByName("173.194.35.133");
     System.out.println("Reachable Host: "+adr.isReachable(3000));  
     boolean status = inet.isReachable(3000);  
     System.out.println("Reachable Host:" + status);      
}
catch (IOException e) {             
     e.printStackTrace();         
}

Either using the boolean or not.
Hope that helps :)

StephNicolaou 32 Posting Whiz in Training

Unfortunately, GoDaddy doesn't allow you to increase your database size limit.

However you can have more than one database, if you upgrade you account plan.

If you have the Economy plan, you can have 10 databases, Deluxe gives you 25 database and you can also have an Unlimited plan.

The PHP sqcript to get your database size is as follows:

<?php
$db = mysql_connect("hostname", "username","password"); // MySql database connection
mysql_select_db("dbname",$db); //Select the database
?>

<?php
{
$sql = "SHOW TABLE STATUS"; //Command to get the database status
$result = mysql_query($sql); 
while($row = mysql_fetch_array($result))
{
$dbsize = $row['Data_length']+$row['Index_length']; // Columns 'Index_length' and 'Data_length' of each row calculated
}
echo($dbsize); // Print the database size
}
?>

Once you have the size (with $dbsize) you can check that thedbsize < 1GB and if true, run the following PHP script to create a table and it's tables:

<?php
$con = mysql_connect("hostname", "username","password"); 
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

// Create database
if (mysql_query("CREATE DATABASE my_db",$con))
  {
  echo "Database created";
  }
else
  {
  echo "Error creating database: " . mysql_error();
  }

// Create table
mysql_select_db("my_db", $con);
$sql = "CREATE TABLE Employees
(
FirstName varchar(15),
LastName varchar(15),
Age int
)";

// Execute query
mysql_query($sql,$con);

mysql_close($con);
?>

Hope that helps :)

StephNicolaou 32 Posting Whiz in Training

Modify the double percentage symbols to a single percentage symbol, e.g. '%M %e, %Y'

Double percentages are a literal % symbol.

Here is a MySQL guide to every format available:

http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format

Hope that helps :)

StephNicolaou 32 Posting Whiz in Training

Okay great! You got the UPDATE statement to work without the apostrophies, that's what I would have tried next. Update statements work differently depending on the type of SQL so can never be sure, I used Access for my example.

For updating two tables I would suggest you to play with the following pseudo:

UPDATE PLAYLIST AS a, table_2 AS b
SET PLAYCOUNT = PLAYCOUNT + 1 / a.PLAYCOUNT = b.PLAYCOUNT
WHERE a.ID = b.ID
StephNicolaou 32 Posting Whiz in Training

Can you please put line 15, pst.executeUpdate(); on line 29, after your setString's?
Try that and let us know the exact error message.

StephNicolaou 32 Posting Whiz in Training

Your insert SQL statement is always expecting there to be 8 images and so the undefined variables are the empty files being found. Your SQL needs to be more dynamic, counting the number of files you have prior to the SQL statement.

Here is a working example of a dynamic SQL statement which does what you require:

http://www.dynamicdrive.com/forums/showthread.php?t=34294

Hope that helps

StephNicolaou 32 Posting Whiz in Training

I am assuming you have an EMPLOYEE & CART entity with each of their primary key and attributes, in addition to a link table, e.g. EMPLOYEE_CART with the foreign keys, Employee_ID, Cart_ID and the Sum.

So to store each instance, use the INSERT INTO statement. E.g. INSERT INTO EMPLOYEE_CART VALUES (Employee_ID, Cart_ID, Sum(Amount)).

You can then pull all the information you want to show, like the names and cart information in a SELECT statement via. the relationsional links indicated above.

Hope that helps.

StephNicolaou 32 Posting Whiz in Training

Try changing the equals to VALUES()

E.G.

UPDATE TABLE2 SET VIDEOID,VIDEONAME,DIRECTOR,RATING,PLAYCOUNT VALUES ( 'VIDEOID','VIDEONAME','DIRECTOR','RATING','PLAYCOUNT') FROM TABLE1

Another UPDATE that is possible:

E.G.2

INSERT INTO TBL1 ( A, B, C )
SELECT tbl.[A], tbl.[B], tbl.[C]
FROM aTBL AS tbl
StephNicolaou 32 Posting Whiz in Training

Research the company website, wikiJobs, the financial times news, company news & events in general. Get on linkedIn, follow their company, view their updates and get connected to the contacts that visit your school/uni. Make sure you take your CV (with all relevant experience) and/or business cards - which you can get printed from VistaPrint of similar.

Read everything up on them as you can, their recruitment process and previous experiences may also be online in addition to knowing your stuff in regard to the job you want.

StephNicolaou 32 Posting Whiz in Training

Use the INTO statement after your SQL SELECT statement (..as UniqueClick..) before the FROM elememt.

So .. INTO tableName

tableName will then be created on the fly if not already created, else updated.

http://www.w3schools.com/sql/sql_select_into.asp

StephNicolaou 32 Posting Whiz in Training

Why don't you assign name into a global variable $a before you close the connection on line 13 (part one) i.e. place this line

$a=$row['name'];

after line 12. Alternatively use the same statement on the other page.

StephNicolaou 32 Posting Whiz in Training

Line 27 isn't needed. Has this been solved already now that this is 2 days old?

StephNicolaou 32 Posting Whiz in Training

Are the fields blank or do they have the value zero in them?

StephNicolaou 32 Posting Whiz in Training
public static int getLineNumber() {    
   return Thread.currentThread().getStackTrace()[3].getLineNumber(); 
}

"The index will change based on the JVM version. I believe it changed from 1.4 to 1.5". Resource: http://bit.ly/xLDhVJ

I have changed the index to [3] instead of [2] but try either based on the version you are using until the line number of where function was called from is correct.

Hope this helps :)

DavidKroukamp commented: cool :) +9
StephNicolaou 32 Posting Whiz in Training

Without reading through your whole code, a simple way would to just use the scanner class, "Please enter your name and surname".

Scanner sc = new Scanner(System.in);
string name = sc.next();
string surname = sc.next();
sc.close();

http://docs.oracle.com/javase/1.5.0/docs/api/java/util/Scanner.html

StephNicolaou 32 Posting Whiz in Training

To move data from a table into another table called archive, you have to write a SQL query, e.g.

SELECT * FROM TBL into Archive

And it will create the table Archive on the fly if it's not already created.


'Delete foreign data' is my short way of saying foreign keys, E.G. Employee table has primary keys EmployeeID and a table called EmployeeTimetable will have the foreign key EmployeeID to indicate whos timetable is whos - If you delete the primary key data from the Employee table, EmployeeTimetable will have nothing to refer to...And give you errors as the employee ID will not mean anything to it.

You connect to a database via. the below: (w3schools)

<?php
$con = mysql_connect("localhost","peter","abc123");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
?>

Here are some tutorials on how to connect to a database using PHP:

http://www.tizag.com/mysqlTutorial/mysqlconnection.php
http://php.net/manual/en/mongo.tutorial.php
http://www.w3schools.com/php/php_mysql_connect.asp

That should get you started :)

StephNicolaou 32 Posting Whiz in Training

Well, it depends how complicated/realistic you want this program to be.
If you've wrote the database, you should have students, the courses they are assigned to, their lecturers and their timetables, etc!

Then you can add a database table linked to the courses tables for all the course's assignments/examinations and the dates they are due.

For the front-end interface I would imagine their being a side navigation for the list of courses that particular student is signed up to, (configured as they log into the system, like Blackboard) and there being a center calendar where the deadlines are also shown in there. In addition to a widget/highlighted corner section, that has the countdown for exam(s).

I would create a left navigation for the button to the calendar, latest alerts, course notes, exam locations, also shown on a map, etc.

Anything else you would work on from there, be creative!

To do the actual calculation, you can use the timer control or the DateDiff(date1, date2) method.

Hope that helps :)

StephNicolaou 32 Posting Whiz in Training

Yes, connect to your database as you would normally, connection paths, etc.

And use the SQL statement, DELETE * FROM TBLNAME1, TABLENAME2 ...

How would that database look? The tables would just be empty and you would have to make sure you also delete foreign relational data to ensure you don't get errors in the front end.

Hope that helps :)

StephNicolaou 32 Posting Whiz in Training

Hi there. You are receiving incompatible types because x is and int and z is a double.

Also, are you allowed to change from public parent to Shape myShape = new Shape[10] ?

StephNicolaou 32 Posting Whiz in Training

You don't have to keep setting the frames visibility as true and false, you can use the frame.dispose() method and frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE) method. But either way works.

If you've added the menu item to the menu, remember to implement ActionListener for your class and use the addactionlistener method:

menuItem.addActionListener(this);

Check out the links I gave you, it's all there :)

StephNicolaou 32 Posting Whiz in Training

Select all the fields you want to use and place MAX() around the field you want. Then you have to group by everything youve selected and order by a field ID.

SELECT TBL.field1, MAX(TBL.field2)
FROM TBL
WHERE TBL.childid on TBL.childid and
(parent.name LIKE '%$search%') GROUP BY field1, field2ID ORDER BY field2ID

Have to dash. Hope that helps :)

StephNicolaou 32 Posting Whiz in Training

First you have to drag and drop the combo box into the form. Then, under the Form Load event in the Code Builder, you call the two options, I'm assuming from a database, using the RowSource method and SQL:

Me.ComboBox.RowSource = "SELECT * FROM [Duties] IN '" & DatabasePath & "' "
Me.Requery

If you are not using a database, just write them in yourself:

Me.ComboBox.RowSource = "Duty1" & ";" & "Duty2"
or Me.ComboBox.RowSource = 1 & ";" & 2

To get the selected value, just use the .Value method:

variable = Me![Combobox].Value 
or variable = Me.Combobox

You can replace Me![Combobox] to [OtherFormName]![Combobox].Value if you are getting it from another form.

Hope that helps :)

StephNicolaou 32 Posting Whiz in Training

Create a button and the command button wizard will pop up. Go to the category, Form Operations and choose 'Open Form'. A list of your forms will appear/ and select the form you want it to go to when the button is clicked. Then you can write the text you want it to say on the button, like 'Back' and click, next and finish.

This won't close the current form so if you are familiar with VBA coding, go to the property bar, tab Event and click the 'On Click' button. This will take you to the code and if no code is currently under the button a Choose Builder menu will appear. Select 'Code Builder' and see below:

    'This will close the current form. Alternatively, Me.Visible = False
    DoCmd.Close

    'This will open the open you on click of the button
    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "The forms name"
    DoCmd.OpenForm stDocName, , , stLinkCriteria

Hope that helps :)

StephNicolaou 32 Posting Whiz in Training

Under your main method (public static void main(String[] args)) call a createAndShowGUI() method that constucts and sets visible the main frame you want to use. Then under your public method you can use the JMenubar package to create menu items that open your other frames. Using this you can create menu items and add them to the menu using methods menuItem = new JMenuItem("part 1") and menu.add(menuItem).

To see the full example, go to:

http://docs.oracle.com/javase/tutorial/uiswing/components/menu.html

Or you can simply constuct, add, set action listeners of buttons using the:

button = new JButton("Button"),
addActionListener(this) and
add(button) methods, as well as many other things.

Set visible the frame/ "part" you want to appear under each menu button.

Go to the Oracle docs to see these examples:

http://docs.oracle.com/javase/tutorial/uiswing/components/frame.html

StephNicolaou 32 Posting Whiz in Training

Yes, on logging in each user will have a session, also opening the data relevant to them from an SQL query... Look at where the sumbit blog button code is and add the 2point's global variable to the user's total points variable which can then be stored in the user's records of the backend database using an INSERT SQL query.

PHP Sessions
http://www.w3schools.com/php/php_sessions.asp

PHP/MYSQL
http://www.w3schools.com/php/php_mysql_insert.asp

StephNicolaou 32 Posting Whiz in Training

To go to then next question, you just need to increment the question_id value by one each time the next button is pressed. Then just increment a count value every time an option box is selected.

StephNicolaou 32 Posting Whiz in Training

Not if it works like a Microsoft disc license or Sky TV link codes where you can use them on a limited number of computers.

StephNicolaou 32 Posting Whiz in Training

Not really, if the foreign key value changes, it loses the relational link to the primary key. So you then lose the integrity of the information as the row values will link to another primary key value of different data, or nothing if it doesn't exist causing an error.

You can physically change the foreign key value to match to another primary key value, when modifying a mistake made, e.g. the foreign key's record meaning to match a different primary key's record.

E.g. Employees and Employee Scores.
Employee101 scored at 55%
Employee102 scored at 60%

Say that these have (somehow!) mixed around in the database, so you have to change the foreign key EmployeeID of Employee102 (in the Scored table), to the EmployeeID of Employee101 so that Employeee101 scored 60% (and vice versa otherwise Employee101 scores both 55% and 60%).

This type of mistake wouldn't really happen unless you coded the front end to mess with the values input into the system.

StephNicolaou 32 Posting Whiz in Training

Not directly in the database, the additional rows for the customer's other dates would be required - showing the customer email again and again for every date they have in each row.

This can be done in the front end when you get to coding/ managing your layout. I can't really say how right now with not knowing what language/ type front end you're using...

The SQL query needed, to see all customers (email's repeated for each date) would be to just select all and order by customer email:

SELECT *
FROM eshop_flat_sales_order
ORDER BY customer_email;

:)

StephNicolaou 32 Posting Whiz in Training

I got the query to work using this statement:

SELECT *
FROM eshop_flat_sales_order
WHERE (((status)="complete") AND ((customer_email)="a(at)a.com"));

You would have to replace "a(at)a.com" as a variable name input from your front end, along with "complete" if you would like the user to select the status as well.

In order to get the number of days between two dates, you would need to use the DATEDIFF(date1, date2) method.

However, as your dates you want to compare are in different rows and not two dates in one row, (as shown in examples), you have to use this subquery statement:

SELECT id,customer_email,  date,   
DATEDIFF((SELECT MAX(date) FROM eshop_flat_sales_order WHERE date < a.date),     date) AS days_since_last FROM atable AS a

Resource used:
http://stackoverflow.com/questions/7375373/select-difference-between-row-dates-in-mysql

Hope that helps :)

StephNicolaou 32 Posting Whiz in Training

I would advise you to try and place the DISTINCT element at the beginning of the statement and work from there, e.g.

SELECT DISTINCT brands.brand_id FROM brands INNER JOIN products ON brands.brand_id = products.brand_id WHERE products.stock > 0"

Alternatively, remove the inner join and use the match in the WHERE statement.

SELECT DISTINCT brands.brand_id FROM brands, products WHERE products brands.brand_id = products.brand_id AND products.stock > 0"

Hope that helps

StephNicolaou 32 Posting Whiz in Training

I can't see anywhere that you have constructed any frame or panel in which to add to the frame to then set it frame visible, you can also use a Container...

e.g.

JPanel p = new JPanel();
p.setLayout(new BoxLayout(p, BoxLayout.PAGE_AXIS));
p.add(label1);         
p.add(label2);

I would suggest you look at the BoxLayout or JFrames/Panels tutorials so you can see how a basic class is put together as a whole. Oracle uses a container or you can construct a frame and panel to then add the panel to it. Links provided below:

Box Layout Examplehttp://docs.oracle.com/javase/tutorial/displayCode.html?code=http://docs.oracle.com/javase/tutorial/uiswing/examples/layout/BoxLayoutDemoProject/src/layout/BoxLayoutDemo.java

Box Layouts http://docs.oracle.com/javase/tutorial/uiswing/layout/box.html

Panels http://docs.oracle.com/javase/tutorial/uiswing/components/panel.html#creating

Frames: http://docs.oracle.com/javase/tutorial/uiswing/components/frame.html

I would also make the lables public as you want to use them in a public method.

Hope that helps

StephNicolaou 32 Posting Whiz in Training

The best way is the IsNumeric(inputValue) method saying:

If Not IsNumeric(inputValue) Then
    MsgBox "Please enter a number!"
Else
    do whatever
End If

Another way is using an if statement checking for 1, 2 and 3 - not a wide range of numbers to say:

If not (inputValue = 1 or inputValue = 2 or inputValue = 3) Then

     -do whatever

         Else 

         If IsNull(inputValue) Then
             do whatever
         End If

        Else

        MsgBox "Please enter a number"
End If

After the enter button, or mouse has clicked off the text box - whichever way you're doing it.

StephNicolaou 32 Posting Whiz in Training

Okay that's good news! I thought so, it has to match correctly with the XSL :)

StephNicolaou 32 Posting Whiz in Training

It's printerJob, I would advise you to take a look at oracle documents which explain everything to do with setting the jobs, rendering with the Printable interface and opening the printer dialog.

Go through the document list and look at the examples and you should be able to then put something together. Also look at the class file and let us know if you have any problems.

Start with using the java.awt.print.* package as noted.

Oracle:
http://docs.oracle.com/javase/tutorial/2d/printing/printable.html

http://docs.oracle.com/javase/tutorial/2d/printing/dialog.html

Class file:
http://docs.oracle.com/javase/1.4.2/docs/api/java/awt/print/PrinterJob.html

Hope that helps :)

dantinkakkar commented: Excellent answer [I would like to add something to make the job easier, though.] +3
StephNicolaou 32 Posting Whiz in Training

One option is to use a while in JavaScript with a boolean to indicate an upload is being carried out:

while (uploading = true)
{
document.getElementById("123").disabled = true; or
document.theForm.theButton.disabled;
}
StephNicolaou 32 Posting Whiz in Training

Can you please post your XML? I would initially check your node names and structure.

StephNicolaou 32 Posting Whiz in Training

Have you checked you php.ini file to see whether you SMTP address and port details are correct? I can't see line 38 in sendmail.php but that's the first place I would look according to your error message.

StephNicolaou 32 Posting Whiz in Training

Since this is your first post, try to make sure you use the code brackets next time you post. First things that come to mind is checking your refresh-rate, setting the image as background, reducing the size of your window/ enlarging your picture and checking all of your window properties. Post any code relative to the image.

StephNicolaou 32 Posting Whiz in Training

You could try following these instructions before using the return value for the presentation (line 6).

These use the Input method:

http://stackoverflow.com/questions/938796/vba-read-lines-from-text-file-exclude-top-two-lines

http://vbadud.blogspot.com/2007/06/vba-read-text-files-with-leading.html

StephNicolaou 32 Posting Whiz in Training

Firstly, you're missing the master data for the people attending the lecture table. You can either have 2 tables; Student Master and Staff Master or a Persons table with a Student/Staff drop-down menu from a PersonsType table.

2. You don't really need two TimeTable's, you can add a Join table between Persons and TimeTable, thus called Persons_Timetable. This should have the fields PersonsID and ClassID. Then you can either show the timetable for one particular student or one particular staff member with all the students they are teaching. Depends on how you would like to write your query.

3. The Working Hours table. You could just add a lengthTime to the SubjectMaster table and work out how many hours the staff member has worked by the subjects they are assigned to. However, if you want it to be like business real-world clocking system in and out of lectures (which is not how the education industry works but whatever), you should add the PersonsID field to the Working Hours table assuming their ID card is coded with their PersonsID card in the DB.

4. The subjectCode in the TimeTable and StaffAllocation table should be a foreign key of the SubjectMaster assuming that you would still like to keep the StaffAllocation table instead of my suggestion of the Persons_Timetable to allocate them together.

Just Remember, a table holds data solely related to that entity/ thing. When it's field like subjectcode is used in another timetable, that isn't a …

StephNicolaou 32 Posting Whiz in Training

You could try doing something practical like:

- A banking system
- A grid navigation system
- An employee HR system
- A game like pacman, battleships, connect 4

These are good ways where you are going to get a lot of interaction with the user, however for most things you will need more than 1 class.

StephNicolaou 32 Posting Whiz in Training

The username and password on the connection has to be the username and password of the database. Post the code you have... And if all else fails the DAO method is a lot easier.

Dim rs As DAO.Recordset
    Dim db As DAO.Database
    Set db = CurrentDb
    Dim path As String
    
    '--------------------------------------------------------
    'BACKEND DATABASE PATH
    path = "C:\path\DB.mdb"
    '-----------------------------------------------------------
    
    'Open all tables
    Set rs = CurrentDb.OpenRecordset("SELECT Name " & _
                                    "FROM MSysObjects IN '" & path & "' " & _
                                    "WHERE Type=1 AND Flags=0")

    'Retrieve data from a table
    Me.RecordSource = "SELECT * FROM [TBL] IN '" & path & "'"
    Me.Requery