Hey guys im stuck in a project for school..

i need to creat a console app that stores info in tables.

so were im confused is the part were the search is..

so i the client inputs an id for customer,but i want to check the table(lets say artist) if it exists?

but from the readline but i need to convert to int32 since it is an int ID...

2 Years
Discussion Span
Last Post by techker

Well convert it then, I don't see where the problem is. Once you are done with the conversion, use that same variable (converted) to pass it into your query. You have plenty of examples online, one of them:http://www.dotnetperls.com/sqlparameter
when you attempt something, then post your code here if you run into trouble.


sorry i just started my courses..

so i got
so my issue is that im used to php and mysql..my teachers said that i need to but that a side for now..cause i can get mixed up..
so were im confused

the if

i need to read the line and search table for id_Artiste

(sorry french classes)

struct Oeuvre //table Oeuvre
            public string Titre;
            public int id_O;
            public int Id_Artiste;
            public string AnneeAquis;
            public double ValeurEstimer;
            public double PrixdeVente;
            public string etat;
           // public string Suivis;


        static Oeuvre[] Oeuvres = new Oeuvre[10];
        static int nbreO = 0;

    static void rechercheOeuvres()
                 string[] Oeuvres = new string[10];

                 Console.WriteLine("enter id ? ");
                 int nb_element = Convert.ToInt32(Console.ReadLine());


I'm sorry I thought that you have a database involved. Just use a for loop and inside your for loop check if the id matches the user-input, if it does then print out the information or whatever you want to show to user.

for(int i=0; i < Oeuvres.Length ;i++)


the id is already stored in the database.

so lets say the database is empty,user inserts info 1 with id

then info 2 with id but he can't repeat the previous id..

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.