How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask shorecc Your Own Question

shorecc
shorecc, Computer Software Engineer
Category: Programming
Satisfied Customers: 148
Experience:  Lead Software Engineer at one of the largest Printing Presses on East Coast
Type Your Programming Question Here...
shorecc is online now
A new question is answered every 9 seconds

Hi. I have a database created in Mysql, and I am using Visual

Resolved Question:

Hi. I have a database created in Mysql, and I am using Visual Basic. Then I have a combobox with datas from one of the tables, f.example a table: CustomersID, CustomersName. I have managed to show CustomersName in the combobox, but I want to show datas from a select-sentence when i click the OK-button!

For now I am using an IF-sentence for each row, and this would be difficult if I have 1,000 different dataes. Here's is my code with IF-sentence:

If cmBoxEval.Text = "Sluttevluering i Info 1" Then
lblSpørsmål.Visible = True
minCommand.CommandText = "select distinct spmTekst from tblsporsmal, tblevaluering, tblalternativ where tblsporsmal.spmEvalID = tblevaluering.evalID and tblsporsmal.spmID = tblalternativ.altSpmID and evalNavn = 'Sluttevluering i Info 1'"
tblsporsmal.Clear()
minAdapter.Fill(tblsporsmal)
BindingSpørsmål.DataSource = tblsporsmal
navSpørsmål.BindingSource = BindingSpørsmål
lblSpørsmål.DataBindings.Clear()
lblSpørsmål.DataBindings.Add("Text", BindingSpørsmål, "spmTekst")

So, what I really want to do is to use the same select-sentence on the lines 3,4,5 but change the "evalNavn" automatically to the selected item in the combobox! Is this possible? Or do you have another way to do it?
Submitted: 2 years ago.
Category: Programming
Expert:  shorecc replied 2 years ago.

shorecc :

Hello, I believe this is possible, but I would need to see the code to see more clearly what you are trying to do. If you could please post your project on www.wikisend.com it will provide you with a download link for me. Copy and paste that link here, then we can take a closer look. Thanks!

Customer:

Here is a link!

Customer:

DANGEROUS URL REMOVED

Customer:

I am norwegian, so some of the label names are XXXXX XXXXX but I hope it doesn't make any problem understanding!

shorecc :

Thank you, XXXXX XXXXX reason it is saying DANGEROUS URL REMOVED is this an exe? Please ZIP these files and then the system will allow the link

shorecc :

Hopefully shouldn't be a problem!

Customer:

I just linked the code for the form I have trouble with.

Customer:

It is not an exe, it is an vb. file

Customer:

Did it work`?

Customer:

Should I try to link it again?

shorecc :

Sorry it did not work. Yes please try to link again. Perhaps ZIP the file, this should gaurantee success. Thanks!

Customer:

do you think it would work if I write the code in a doc-file? and then zip it?

Customer:

http://wikisend.com/download/622936/Imports MySql.zip

Customer:

here is the link again. forum link: Imports MySql.zip

shorecc :

Thank you, XXXXX XXXXX successfully downloaded the project and will begin to look at it.

shorecc :

From what I understand, is you wish to run a SELECT statement automatically and loop through it a few times, changing the sql statement a little each time? Please advise if this is correct, if not could you clarify your question a little more?

Customer:

Yes, this is what i want to do. change the where-statement!

Customer:

Do you mind answer another question? About MySql? I have my exam, so this is why I'm asking!

shorecc :

Of course you may ask another question!

shorecc :

So what you need to do, is add a Parameter to the Fill method of your Table adapter

shorecc :

Click the dataset in the data sources window, and then click 'edit dataset with designer'

shorecc :

Then, where you have your table adapter right click where it says Fill

shorecc :

click configure and you can add a parameter through here

shorecc :

for instance it could say SELECT distinct spmTekst from tblsporsmal, tblevaluering, tblalternativ where tblsporsmal.spmEvalID = tblevaluering.evalID and tblsporsmal.spmID = tblalternativ.altSpmID and evalNavn = ?

shorecc :

as you see, you will put a question mark where you wish to have the variable

shorecc :

then you can change your call to


da.Fill(ds, ValueToSendToParameter)

Customer:

thank you so much for you answer! I managed to fix it! But now I have another question!

shorecc :

Great!

shorecc :

Go ahead

Customer:

I have made a quiz in SQL where all the questions have 5 alternatives each. Then I have a SQL-sentence which is printing out which alternative the persons who have taken the quiz have been choosen when they answered. This SQL-sentence is: select spmTekst as Spørsmål, alttekst as Alternative, count(*) from tblsvar, tblalternativ, tblsporsmal, tblevaluering where svaraltid = altid and altspmid = spmid and tblevaluering.evalID = tblsporsmal.spmEvalID and evalNavn = 'Sluttevaluering i Mat 2' group by svaraltid. This sentence prints out the questiontekst, the alternative text and how many persons who has answered the alternativ on that question. Now, I want to show this statistic with a chart in visual basic! With the X-value is the alternativID and Y-value is how many persons who answered the alternative.

Customer:

Hope you understood!

shorecc :

where all the questions have 5 alternatives each.

shorecc :

what do you mean by alternative?

shorecc :

answers?

Customer:

yes! answers

shorecc :

=) ok thanks...Im just making sure i am understanding correctly!

shorecc :

Ok so basically you'd like to show a chart in visual basic

shorecc :

of how many people answered the question correctly?

Customer:

yes! all the questions have different alternatives (possible answers). and I want to show how many people answered the question, or more precisly which answer they chose.

Customer:

one question could be (an example). What does the dog says? a) Voff b) Mjau c) zz. And I want to show how many people who choosed a),b) and c)1

shorecc :

Ok so your first thing to do would be to get all of these choices into an ArrayList

shorecc :

For each answer, arraylist.add(answer)

Customer:

could this be done automatically from the database? because the questions and answers is in the databse

shorecc :

Oh yes

shorecc :

To use your database and charts, I would look into Crystal Reports

Customer:

Sorry for my many questions, but I have my exam now!

shorecc :

Its ok!

shorecc :

Crystal Reports is the way to use your database and make charts automatically

shorecc :

It is pretty complex subject, however

Customer:

okey

shorecc :

Please refer to : http://www.codeproject.com/Articles/142064/Step-by-Step-Creation-of-Crystal-Report-using-its for a complete explanation of Crystal Reports/Databases/Charts

Customer:

So the first thing to do is to follow these steps?

shorecc :

yes, but it is something that will take a few hours to learn

Customer:

okay

shorecc :

I wish I could give you the quick and easy answer, but for charts and databases there is no quick and simple way

Customer:

that's okay! I will try do this! Thank you so much

shorecc :

You are welcome! Good luck! Please let me know if you have any other questions

shorecc, Computer Software Engineer
Category: Programming
Satisfied Customers: 148
Experience: Lead Software Engineer at one of the largest Printing Presses on East Coast
shorecc and 9 other Programming Specialists are ready to help you
Customer: replied 2 years ago.
Hi. I want to export data from a datagrid to excel. Do you have any good tip to do this in a simple and quickly way?
Expert:  shorecc replied 2 years ago.
Hello,
Here is a website that shows a quick and simple way :
http://vb.net-informations.com/excel-2007/vb.net_export_from_datagridview_to_excel.htm

Remember, if for any reason you are unsatisfied with my answer, we can continue the conversation until you’re satisfied and Accept my answer. I can address follow up questions at no extra charge and I’m always here to help. Thank you for using JustAnswer!
Customer: replied 2 years ago.
Now, I've tried the code you gave me from the internet site, but I get an error!
COM Exeption was unhandled. Invalid Index. (Exception from HRESULT: 0x8002000B (DISP_E_BADINDEX))
the error occured on this line: xlWorkSheet = xlWorkBook.Sheets("sheet1")
Expert:  shorecc replied 2 years ago.
This means an index you have created is going out of bounds somewhere, are you sure you are not going outside the parameters of the array?
Customer: replied 1 year ago.

Hi!


I have some howework in JAVA programming where I want to register some animals. I have a class called Animals with constructor and different variables. (String id, String sex etc.)


Then I have a menu in another class called Kontroll with different choices to navigate. In this menu I use case as navigation. (example, press 1 for animals, 2 for other animals etc.)


Then I have a method with questions about animalinformation and then put the information into an arraylist. I have managed to write the code for the method right ( I think), but when I'm going to open the method in the case-statement I get an error: "Method RegNyHare in class Brukergrensenitt cannot be applied to given types". Here's my code. Some help with this error?


 


The part of the case:


switch (menyRegValg){
case 1:
Brukergrensesnitt.RegNyHare(); --> RegNyHare is where I get an error!


 


Brukergrensesnitt class:


 


public static void RegNyHare(String id, int kjønn, double vekt, double lengde, String dato, String fangststed, String HareFarge, String HareType){ ;
ArrayList hareListe= new ArrayList();
java.util.Scanner scan = new java.util.Scanner(System.in);

id = "H" + (hareListe.size() + 1);
Hare nyHare = new Hare(id, kjønn, vekt, lengde, dato, fangststed, HareFarge, HareType);
System.out.println("VENNLIGST SKRIV INN INFORMASJON OM NY HARE. "+(id));
System.out.print("Kjønn, 1 for hann eller 2 for hunn: ");
kjønn = scan.nextInt();
System.out.print("Vekt på hare (i kg) : ");
vekt = scan.nextDouble();
System.out.print("Lengde på hare (i cm): ");
lengde = scan.nextDouble();
System.out.print("Dato for fangst : ");
dato = scan.nextLine();
System.out.print("Sted for fangst : ");
fangststed = scan.nextLine();
System.out.print("Pelsfarge, B for brun eller H for hvit : ");
HareFarge = scan.nextLine();
System.out.print("Type hare, V for vanlig eller S for sørhare : ");
HareType = scan.nextLine();
hareListe.add(nyHare);
System.out.println("Du har nå registrert følgende opplysninger på ny hare :" + nyHare);


}


 


Do I get this error because I have RegNyHare(); in the case, and RegNyHare (String id, String ... etc) in the method?


 


 


 


 


 


 

JustAnswer in the News:

 
 
 
Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.
 
 
 

What Customers are Saying:

 
 
 
  • My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer New York
< Last | Next >
  • My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer New York
  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
  • This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!! Alex Los Angeles, CA
  • Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult. GP Hesperia, CA
  • I couldn't be more satisfied! This is the site I will always come to when I need a second opinion. Justin Kernersville, NC
  • Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around. Esther Woodstock, NY
  • Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know. Robin Elkton, Maryland
 
 
 

Meet The Experts:

 
 
 
  • ATLPROG

    Computer Software Engineer

    Satisfied Customers:

    7463
    MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
< Last | Next >
  • http://ww2.justanswer.com/uploads/SP/spatlanta2010/2011-6-23_12450_photo.64x64.gif ATLPROG's Avatar

    ATLPROG

    Computer Software Engineer

    Satisfied Customers:

    7463
    MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
  • http://ww2.justanswer.com/uploads/ComputersGuru/2010-02-13_051118_Photo41.JPG LogicPro's Avatar

    LogicPro

    Computer Software Engineer

    Satisfied Customers:

    5603
    Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.
  • http://ww2.justanswer.com/uploads/unvadim/2010-11-15_210218_avatar.jpg unvadim's Avatar

    unvadim

    Computer Software Engineer

    Satisfied Customers:

    1158
    Good knowledge of OOP principles. 3+ years of programming experience with Java and C++. Sun Certified Java Programmer 5.0.
  • http://ww2.justanswer.com/uploads/lifesaver333/2010-10-17_191349_ls.jpeg lifesaver's Avatar

    lifesaver

    Computer Software Engineer

    Satisfied Customers:

    950
    Several years of intensive programming and application development experience in various platforms.
  • http://ww2.justanswer.com/uploads/EH/ehabtutor/2012-8-2_202016_1.64x64.jpg ehabtutor's Avatar

    ehabtutor

    Computer Software Engineer

    Satisfied Customers:

    864
    Bachelor of computer science, 5+ years experience in software development, software company owner
  • http://ww2.justanswer.com/uploads/RA/rajivsharma086/2012-6-6_17128_displaypic.64x64.jpg Raj's Avatar

    Raj

    Computer Engg.

    Satisfied Customers:

    860
    BE CS, 4+ Experience in Programming and Database (ERP)
  • http://ww2.justanswer.com/uploads/eljonis/2010-01-06_130406_eljon2.jpg Eljon's Avatar

    Eljon

    Consultant

    Satisfied Customers:

    590
    11 yrs of programming (PHP, WordPress, XSL, SQL, JavaScript)