rotten69 20 Posting Whiz

Hey,

CREATE OR REPLACE TRIGGER "TRI_AMOUNT_REDUCTION"
	      AFTER INSERT ON "PURCHASE"
	      FOR EACH ROW
	    BEGIN
		IF (:NEW.CLIENTNO = 122336) THEN
			:NEW.AMOUNT := AMOUNT * 0.1;
		END IF;
	    END;
	    /

I have a query that selects my top client then want to pass the clientNo to the trigger. Is it a good idea to put my select statement in the trigger instead ?

rotten69 20 Posting Whiz

yeah thanks for the help, mate. I have dropped the constraints on tables but they are stored in recycle bin. And their names are starting with BIN.... like an encrypted name. To solve this problem, I had to use

PURGE TABLE table_name
rotten69 20 Posting Whiz

any idea on how to do this, mate?

rotten69 20 Posting Whiz

Hey everyone,

I'm just wondering if there is a way to get around this problem. I'm running SQLplus on UNIX server and SSHing into the server. Whenever I query Oracle DB, a list of results/bunch of tables comes up but I can not scroll up to the top of tables..... Any solution to this? SQLplus shows me around 80-100 lines

And, Is there a way to delete all constraints on table at once?


cheers,

rotten69 20 Posting Whiz

Hi everyone,

I've been trying different commands that check inputs that will be entered into the tables I've got. I want to check that Amount/Ename columns can not be NULL.

What's <> do in SQL?

// first command
 ALTER TABLE Emp ADD CONSTRAINT CK_AMOUNT CHECK ( AMOUNT NOT NULL);

 // second command
 ALTER TABLE Emp ADD CONSTRAINT CK_AMOUNT CHECK ( AMOUNT != NULL);

They accept null values and the default value is 0

//first command
 ALTER TABLE Emp ADD CONSTRAINT CK_ENAME CHECK ( Ename NOT NULL);

// second command
 ALTER TABLE Emp ADD CONSTRAINT CK_ENAME CHECK ( Ename != NULL);

I also want my tables to accept specific values, for example, payment method has to be one of these options such as master card, visa or cash.

ALTER TABLE Emp ADD CONSTRAINT CK_Pay CHECK ( Pay="master card" OR "visa" OR "cash");

Thanks for the help..

rotten69 20 Posting Whiz

I don't think you need to register in order to download a SQL Plus software from Oracle site. Always go to Oracle site and download their product/s..

rotten69 20 Posting Whiz

Thanks guys for passing by.

@ Christot... No offense is taken at all. Every opinion is respected as much as it deserves the respect. At the end of the day, it is just an opinion.

@Stephen...Any good websites to start with?


:)

rotten69 20 Posting Whiz

Hi everyone,

I am doing a Java course at uni at the moment and it kinda doesn't make you become a real programmer with the confidence that a programmer should have. I really want to program in Java and any language(not python though because it is not a user-friendly programming language... its syntax is horrible!!! sorry python programmers) The problem I'm facing is that I don't know how to think like a real programmer.. If anyone can help, that'd be GREAT and be a life saver for a young man like me..

Looking forward to fellows' thoughts on this...

rotten69 20 Posting Whiz

I'm still getting the same error.. I think the query is right but what's after it isn't. Inside the WHERE clause; wouldn't this right to put (ColumnName.TableName and not the other way around)?


Thanks.

rotten69 20 Posting Whiz

And, I know I'm missing a comma on line 9 of the second method

rotten69 20 Posting Whiz

Thanks, Buddy. But, My flightSearch method is not working. If it was, I'd pass it to the review method and I am not sure how to do this.

rotten69 20 Posting Whiz

Hi everyone;

I'm working on a c# service that queries the DB and checks if the right info is available for users. It's an Airline tickets reservation system.

I am not sure why my code is breaking after it gets the query and it gives an error about sqlclient..

This is the error message I get.....

 System.Data.SqlClient.SqlException: Incorrect syntax near '.'. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) at WebService1.Service1.flightSearch(String depAirport, String arrAirport, String depDate, Int32 numOfSeats)
[WebMethod]
        public string flightSearch(string depAirport, string arrAirport, string depDate,  int numOfSeats)
        {
            
            SqlConnection conn = new SqlConnection(connString); 
            DataSet ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter();
            //int result = 0;
            
            try
            {
                conn.Open();
                string query = "SELECT departure_date, airport_location, seat_capacity,    origin_airport_code, destination_airport_code FROM Flight_Schedule, Airport, Travel_Class_Capacity";

                query += "WHERE airport_location.Airport= '" + arrAirport + "' AND airport_location.Airport='" + depAirport + "' AND departure_date.Flight_Schedule='" + depDate + "' AND "; …
rotten69 20 Posting Whiz

Nice and easy explanation. I can't add anything to it.

rotten69 20 Posting Whiz

Thanks, pal. I don't have 40 text boxes. And, the problem was that I user another text box for post code..

rotten69 20 Posting Whiz

hey everyone,

I'm just having a problem debugging this line and I don't see anything wrong with it. I tried using SelectValue and other ways but nothing seems to be working. The error message I get is that Exception Details: System.FormatException: Input string was not in a correct format.

if (check.PostalCodeChecking(DropDownList2.SelectedItem.Text, Convert.ToInt32(TextBox40.Text) ) == false)
    {
    Label2.Visible = true;
    }

The input in TextBox40 should be numeric..

Thanks in advance..

rotten69 20 Posting Whiz

the input is a numeric type

rotten69 20 Posting Whiz

hey everyone,

I'm just having a problem debugging this line and I don't see anything wrong with it. I tried using SelectValue and other ways but nothing seems to be working. The error message I get is that Exception Details: System.FormatException: Input string was not in a correct format.

if (check.PostalCodeChecking(DropDownList2.SelectedItem.Text, Convert.ToInt32(TextBox40.Text) ) == false)
            {
                Label2.Visible = true;
            }

Thanks.

kvprajapati commented: Take care to "type" question title. -3
rotten69 20 Posting Whiz

Hey everyone,

I looked around if anyone has the same error. there are people who have had this error, but I couldn't really get to the point that what causes this error to occur. I thought the data types in my table are the reason and I changed them. But, I still have the problem occuring. I would appreciate any help so much.

rotten69 20 Posting Whiz

I knew the answer, but I wanted to make sure that I had the right one. It was assessed so I had to ask around.. lol I'm such a lazy chap hey,

rotten69 20 Posting Whiz

Anyone there to take the time to explain that and be eventually thanked for the time as well :)

rotten69 20 Posting Whiz

Hmmm, I'm required to use ADO.NET database for my little project that is a user account management. Once I have it up and running then I need to use LINQ to SQL. I'm very new to c# so I don't know that much about the different classes and things. I'd be very thankful if someone takes the time to explain the major differences between those ways/classes. What packages do I need to import into my service in order to use ADO.NET or LINQ to SQL?

And, I am not sure how this would work. I think I need to invoke different methods when a user clicks on the button in the registration form. So, I'd have a few methods such as checking user, updating user and deleting user. So, if user is existing in my DB then allow them to do certain things like updating their info or even deleting their info. If not, then make them register. Any ideas how to go about this small system?

CHEERS,

rotten69 20 Posting Whiz

Cool. Hmmm, what's the difference between ADO.net and the sql way of querying a DB?

What classes do I need to use for each of them?

rotten69 20 Posting Whiz

OK. When I hover on the underlined objs, the compiler says "Conn is 'field' but used like a type".. Any idea what it is ? how to fix it>?

rotten69 20 Posting Whiz

Your help is pretty much appreciated. And, thanks in advance.

rotten69 20 Posting Whiz
public class Service1 : System.Web.Services.WebService
    {
       
         string connString = @"Data Source=.\SQLEXPRESS;AttachDbFilename='C:\.....\ADO.NET\App_Data\Database1.mdf';
                            Integrated Security=True; User Instance=True";
                            
        SqlConnection conn = new SqlConnection();
       
        conn.ConnectionString = connString;
        conn.Open();

       
       /*
        string sQueryString = "SELECT users FROM users";
        OleDbCommand myCommand = new OleDbCommand(sQuery, conn);
        OleDbDataReader myReader = myCommand.ExecuteReader();

        while (myReader.Read() )
        {
            Console.WriteLine(myReader.GetString(0) );
        }
        
        myReader.Close(); */                            If I'm querying my database, do I close the query command at the end (after all methods)or before the methods?
        
        
        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }

conn.Close();
rotten69 20 Posting Whiz

Yes, I am running c# program on Windows but the thing is when I instantiate a DBconnection,for example, SqlConnection conn = new SqlConnection();
conn.ConnectionString = connString; I can not use the object "conn" for some reasons. I also rebuilt the service and the entire project and nothing seems to be fixing the problem

rotten69 20 Posting Whiz

Hello everyone,

I'm just having a problem that is stopping me from doiing my work and I've tried fixing it. I don't know what's really wrong with what I've got typed in visual studio.

string connString = @"Data Source=.\SQLEXPRESS;AttachDbFilename='C:\..................\Database1.mdf'; Integrated Security=True; User Instance=True";
                            
        SqlConnection conn = new SqlConnection();
       
        conn.ConnectionString = connString;  
        conn.Open();

--- > the word "conn" is underlined in visual studio so this means that I cannot connect to the BD I created. I have got my DB in my service section instead of having in my application.


Your help is very much appreciated.

rotten69 20 Posting Whiz

No, I mean in the project solution, when you press right-click, there is a link "update your project". I saw it once then I wanted it again. I couldn't find it.

I changed a var's name then re-ran the project and got errors so that is why I'm looking for how to update the project.

rotten69 20 Posting Whiz

G'day everybuddy,

I just have a question about how to update a service on the server after changes are made to the code.

Cheers,

rotten69 20 Posting Whiz

@ddanbe.. WTF!! if you're not willing to help, it's all good. There will be someone to give GREAT help.

Thanks a lot faroooqa.

rotten69 20 Posting Whiz

OK. I type the generated/appearing number in the text box and then it gets evaluated as a false statement (not matched for some reason!!!!) and when the method/function prints the generated number in the result. It is different from the appearing one. I will give ya an example of that.

Let's say the number is 112244 .. I type it in the text box then it is not recognized as a matched number. So, the result I get is that
" the entered number is 112244 and the random number is 225543 and You're not a human "

rotten69 20 Posting Whiz

OK. I type in the showing number and when it evaluates the statement as false then it prints the entered number and the random number(this is new???) how this happens?

rotten69 20 Posting Whiz

I tried this and it always evaluates the statement as a false statement

rotten69 20 Posting Whiz

Anyone there to point out what the problem is? or How to fix it?

rotten69 20 Posting Whiz

Oh, OK. Well, is it also possible to run an online pizza shop or another type of store and that is developed in pure Java, not JSP?

Thanks. I'm so impressed about how much we can do by just using JAVA LANGUAGE.

rotten69 20 Posting Whiz

OK. I have managed to run my little program and am really happy with it after having fixed a silly bug in it. So, now, it doesn't validate the if-statement properly. The condition is that if the typed number is Equal to the given random number then Tell them they're human Or else, otherwise. It jumps straight to the second else-statement even if the typed number is ABSOLUTELY equal to the random number. Any idea why?

rotten69 20 Posting Whiz

it is already defined and attached to the web application. But, I am not sure why the compiler doesn't recognize it.

Sure, it would be nice. Any good help from anyone would be very very much appreciated again.

rotten69 20 Posting Whiz

Thanks for your reply, buddy. The errors are the followings:
" Error 1 'WebApplication3.HumanCheckerService.HumanCheckerApplication' does not contain a definition for 'RandomNumberGenerator' and no extension method 'RandomNumberGenerator' accepting a first argument of type 'WebApplication3.HumanCheckerService.HumanCheckerApplication' could be found (are you missing a using directive or an assembly reference?) C:\Users\Documents\Visual Studio 2010\Projects\WebService1\WebApplication3\Default.aspx.cs HumanCheckerApplication
"


" Error 2 'WebApplication3.HumanCheckerService.HumanCheckerApplication' does not contain a definition for 'HumanChecker' and no extension method 'HumanChecker' accepting a first argument of type 'WebApplication3.HumanCheckerService.HumanCheckerApplication' could be found (are you missing a using directive or an assembly reference?) C:\Users\Documents\Visual Studio 2010\Projects\WebService1\WebApplication3\Default.aspx.cs HumanCheckerApplication
"


I'd also appreciate it so much if you direct me to an awesome site that teaches C# in easy steps.

Thank you for the help again.

rotten69 20 Posting Whiz

Hello everyone,

I'm trying to make a small application that checks on submission if a user is human or not by just copying what's shown on a page and submitting it for validation. OK, I have a few errors with this piece of code and am unsure how to fix it as I'm very very new to c# community.

// HumanCheckerApp.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication3
{
    public partial class _Default : System.Web.UI.Page
    {
        string genRanNum;
        HumanCheckerService.HumanCheckerApplication humanCheck = new HumanCheckerService.HumanCheckerApplication();
       
        protected void Page_Load(object sender, EventArgs e)
        {
            genRanNum = humanCheck.RandomNumberGenerator();
            //Display generated numbers
            Label1.Text = genRanNum;
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            //Send input to webservice for validation
            Label2.Text = humanCheck.HumanChecker(txtBox.Text);
        }
    }
}










// service1.asmx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace WebService2
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/", Name = "Human Checker Service", Description= "This checks whether a user is human or not.")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class Service1 : System.Web.Services.WebService
    {

        [WebMethod]
        public string RandomNumberGenerator()
        {
            Random random = new Random();
            string num = "";
            for (int i = 0; i <= 9; i++)
            {
                num += random.Next(0, 9);
            }
            return num;
        }

        [WebMethod]
        public string HumanChecker(string str)
        {
            if (str == this.RandomNumberGenerator())
            {
                return "You are a human."; …
rotten69 20 Posting Whiz

Yeah, but Aren't vending machines usually programmed in C or machine/assembly languages?

rotten69 20 Posting Whiz

G'day everyone,


I just have a few questions about Java programming language. Before getting started with the question, I was actually doing some reading for my java course and there was an implementation of Coffee vending machine in java. Therefore, the questions came to my mind and these are: Do Java programmers use java to program a vending machine? and how does this implementation work in reality? and the other example was an implementation of pizza vending machine.

rotten69 20 Posting Whiz

Thanks mate.

rotten69 20 Posting Whiz

The program is executed from Eclipse. Thanks.

rotten69 20 Posting Whiz

OK. I have awesomely solved this problem. The answers to both sub-questions are ZERO.

If you want some explanation on this, I'm happy to explain it to anyone. Just ask.

Cheers,

rotten69 20 Posting Whiz

Anyone here to help urgently with this Question, please?

rotten69 20 Posting Whiz

Hi everyone,


I'm just adding these two binary numbers and not sure about the sub-questions(a,b) of the question that are below:

Q1 - What is the (5-bit) result of adding the 5-bit unsigned numbers 10001 and 00111?

Answer: 11000

Q1a - What is the value of the carry in to the most significant bit????


Q1b - What is the value of the carry out of the most significant bit????


Hope to hear from an expert in this area very soon. Thanks.

rotten69 20 Posting Whiz

Awesome. Cheers.

rotten69 20 Posting Whiz

Hey everyone,

my if-statements are working as expected. Actually, they are not working at all. The syntax is right but they are never run. The program terminates before it runs them.

public static void main (String args[]){
		Scanner input = new Scanner(System.in);
		
		Display fName = new Display(); // creating a new obj called fName
		System.out.println("Enter your first name: ");
		String name = input.nextLine();
		
		fName.greeting(name);
		
		
		Display howToDo = new Display();
		System.out.println("How are you," + name + " ?");
		
		
		String name1 = input.nextLine();

		
                if (name1 == "good"){
			System.out.println("We know that you're good. Keep it up!");
		}else if (name1 == "fine") {
			System.out.println("We know that you're fine.");
		}else if(name1 == "ok"){
			System.out.println("We know that you're ok. Improve it lol!");
		} 

 when I use defualt at the end of this blocks, the default condition works.

I tried using switch(name1) --> was giving me errors because of data type.

Thanks,

rotten69 20 Posting Whiz

The adjective (public) given to a class meaning that it is accessible so you can use this public anywhere in your java project. (int void) means that it will return or give you an integer value. And this method takes/expects a String parameter which is specified in between the brackets and it is (String s). So you specify the data type before the variable name as you did in this example. So, the data type for "s" is "String".. I am not sure what's inside the body does if anyone does know it. Please explain it to us. Thanks in advance.

I hope this helps.

rotten69 20 Posting Whiz

Hey everyone,

Just curious why my little program doesn't go through the if-statement I specified in it.

public static void main (String args[]){
		
		
		Scanner sc = new Scanner(System.in);
		
		System.out.println("Enter a value for girls:");
		int GIRLS = sc.nextInt();
		
		System.out.println("Enter a value for boys:");
		int BOYS = sc.nextInt();
		
		
		
		if (BOYS == 12 && GIRLS == 15){
			System.out.print("Here we go, you're passing the test.");
				
		}    <<<<<<<<<<<<<<<<<< Not checking the condition.  After I enter the values, it terminates.