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...

Recommended Answers

All 4 Replies

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..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.