Комментарии:
Hi, I've been following your videos and so far they are perfect. I finally hit a problem.
Using your code for my documents, after I add the four
txt_eid.Text = reader ["EID"].ToString(); lines,
I can still select everything from the combobox, but it stopped linking to the text boxes.
Before I added these lines it would link combobox to textbox, but wouldn't replace it,
Thanks for any help.
Can't get mine to work...give me no errors but just doesn't show the data in the text boxes
Ответитьcant duplicate surname , textbox value of 1 surname = 1
ОтветитьGracias por todo
ОтветитьYou are wonderful. Every things I think about, you talk about it!!!!! Many thanks to you!!!
Ответитьplease send the link of the video that explains the code you used inside the combo box
ОтветитьDual record MARK not work well.
See EID 1 and 12
That was my code..... but unfortunately there was no response.... Does anyone have an idea where the problem lies?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;
namespace LifeCycleEnergyAssessment
{
public partial class YearlyOperationEnergy : Form
{
private OleDbConnection connection = new OleDbConnection();
public YearlyOperationEnergy()
{
InitializeComponent();
connection.ConnectionString @"Provider=Microsoft.ACE.OLEDB.12.0;DataSource=C:\Users\Nehal92\Desktop\Access Database\Primary Energy Conversion Factors.accdb;
Persist Security Info=False;";
}
private void button2_Click(object sender, EventArgs e)
{
this.Hide();
DemolitionEnergy DE = new DemolitionEnergy();
DE.Show();
}
private void YearlyOperationEnergy_Load(object sender, EventArgs e)
{
try
{
connection.Open();
OleDbCommand command = new OleDbCommand();
command.Connection = connection;
string query = "select * from PrimaryEnergyConversionFactor";
command.CommandText = query;
OleDbDataReader reader = command.ExecuteReader();
while (reader.Read())
{
comboBox1.Items.Add(reader["EnergySource"].ToString());
comboBox2.Items.Add(reader["EnergySource"].ToString());
comboBox3.Items.Add(reader["EnergySource"].ToString());
comboBox4.Items.Add(reader["EnergySource"].ToString());
comboBox5.Items.Add(reader["EnergySource"].ToString());
}
connection.Close();
}
catch (Exception ex)
{
MessageBox.Show("Error" + ex);
}
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
connection.Open();
OleDbCommand command = new OleDbCommand();
command.Connection = connection;
string query = "select * from PrimaryEnergyConversionFactor where EnergySource=' " + comboBox1.Text + " ' ";
command.CommandText = query;
OleDbDataReader reader = command.ExecuteReader();
while (reader.Read())
{
textBox18.Text = reader["PrimaryConversionFactor"].ToString();
}
connection.Close();
}
catch (Exception ex)
{
MessageBox.Show("Error" + ex);
}
}
}
}
O-O-ps! I found my mistake in syntax Sorry !
ОтветитьI'm curious how did you make that for the first time. Did it was a book or you search information in forum. Byt the way, really good example ;)
ОтветитьHow about ID ? If I want ID to show from combox and show from textbox ? What I declare ?
ОтветитьWhenever I select any item from combo box, corresponding values are not shown in text boxes but when I select another value from combo box, the previous values are displayed. Please help! I have done the exact same thing. Also, when I double click on combo box, studio creates a function private void pickname_SelectionChanged(object sender, SelectionChangedEventArgs e)
I changed it to function you have but still same thing is happening!
Very Good !
ОтветитьDoes someone know how to let the combobox "query" fill in the textboxes when you have the First and Last name in the combobox instead of only the FirstName from the example lesson #10?
Ответитьwhy its not working to me damn
ОтветитьI have learned quite a bit by watching this series. I do have one issue I hope you can help resolve. If I am using this to keep track of employees or products, how can I get it to update the ComboBox when I add/delete/update anything on this form without closing the form and opening it again?
ОтветитьMany thanks !!
ОтветитьHai
Thnx for your informative video's
But .....
I don't want to have sql code in my C# code, I want to use a file, on my desktop, witch contains my sql code
How can i execute sutch a file in C#
Ok it's not appearing in any of my textboxes
ОтветитьThanks for the video. How do I retrieve data from related tables, like student name from student table, students results from reports tables, these tables are linked with student number (primary key in student table and foreign key in results table) ? I have tried, my sql works on msacess but not on C#.
Thank you in advance
TY MY INDIAN/ARAB FRIEND!
ОтветитьMan, you're the LEGEND of C# :D
Ответитьmere pas to nhi rha ye code...
Ответитьhi i have followed every line of codes but im getting "System.Data.OleDb.OleDbException: 'Data type mismatch in criteria expression.' " help pls
Ответить