Showing posts with label pls. Show all posts
Showing posts with label pls. Show all posts

Monday, March 26, 2012

Normalization

Hi all,

I am still confuse in normalization. (1st, 2nd, 3rd, and more.)

Any body have a detail idea abt that ?
Pls explain with example.

Thxs.

Regards,
Shailesh PatelThis question should be in the data forum...

a non normalized data table for a Company might have columns thus
tblCompany
company
address
city
state
firstname
lastname
telephone
fax
email

now imagine that the same company has 2 employees. the company info gets repeated for each employee. this wastes disk space and create the potential for data to also be incorrect. It also requires a lot of extra tdata entry to keep inputting the same company data.

so lets normalize it by splitting it into 2 tables. A company table and an employee table.

tblCompany
CompanyID
company
address
city
state

tblEmployee
CompanyID
firstname
lastname
telephone
fax
email

These 2 tables are linked on the CompanyID and you can now have many Employees for any single Company. Now one of those pesky employees decided to have 3 different email addresses. So lets normalize the Employee table

tblEmployee
EmployeeID
CompanyID
firstname
lastname

tblEmployeeContactInfo
EmployeeID
telephone
fax
email

These two tables are linked on EmployeeID. Now any single employee can have multiple contact records for an unlimited number of phone, fax or email data.|||Check out this page:

http://www.bkent.net/Doc/simple5.htmsql

Saturday, February 25, 2012

No value given for one or more required parameters.

HI everyone, pls can u tell me whats the error in my code?

I am connecting to an oledb database

sql_edit_record = "UPDATE Anamnese SET ";

sql_edit_record += "ID=?,";

sql_edit_record += "Sexe = ?,";

sql_edit_record += "[Date de Naissance] = ?,";

sql_edit_record += "Classe = ?,";

sql_edit_record += "Ecole = ?,";

sql_edit_record += "Adresse = ?,";

sql_edit_record += "Telphone = ?,";

sql_edit_record += "[Cot de signalement] = ?,";

sql_edit_record += "[Motif de consultation] = ?,";

sql_edit_record += "[Histoire familale] = ?,";

sql_edit_record += "[Histoire mdicale] = ?,";

sql_edit_record += "[Histoire dveloppementale] = ?,";

sql_edit_record += "[Histoire scolaire] = ?,";

sql_edit_record += "[Situation socio-conomique] = ?,";

sql_edit_record += "[Histoire comportementale] = ?";

sql_edit_record += "WHERE Nom = ?";

//sql_edit_record = "UPDATE Anamnese SET Sexe = 'M' WHERE Nom = 'Dory'";

db_adapter.UpdateCommand.Connection = oledb_connection;

db_adapter.UpdateCommand.CommandText = sql_edit_record;

using (db_adapter.UpdateCommand)

{

textBox1.Text = sql_edit_record;

db_adapter.InsertCommand.Parameters.Add("@.ID", OleDbType.VarChar).Value = current_row.ToString();

db_adapter.InsertCommand.Parameters.Add("@.SEXE", OleDbType.VarChar).Value = sexe;

db_adapter.UpdateCommand.Parameters.Add("@.DATEDENAISSANCE", OleDbType.VarChar).Value = date_de_naissance;

db_adapter.UpdateCommand.Parameters.Add("@.CLASSE", OleDbType.VarChar).Value = classe;

db_adapter.UpdateCommand.Parameters.Add("@.ECOLE", OleDbType.VarChar).Value = ecole;

db_adapter.UpdateCommand.Parameters.Add("@.ADRESSE", OleDbType.VarChar).Value = adresse;

db_adapter.UpdateCommand.Parameters.Add("@.TELEPHONE", OleDbType.VarChar).Value = telephone;

db_adapter.UpdateCommand.Parameters.Add("@.SIGNALEMENT", OleDbType.VarChar).Value = signalement;

db_adapter.UpdateCommand.Parameters.Add("@.MOTIF", OleDbType.VarChar).Value = consultation;

db_adapter.UpdateCommand.Parameters.Add("@.HIS_FAM", OleDbType.VarChar).Value = his_familiale;

db_adapter.UpdateCommand.Parameters.Add("@.HIS_MED", OleDbType.VarChar).Value = his_medicale;

db_adapter.UpdateCommand.Parameters.Add("@.HIS_DEV", OleDbType.VarChar).Value = his_developpementale;

db_adapter.UpdateCommand.Parameters.Add("@.HIS_SCOL", OleDbType.VarChar).Value = his_scolaire;

db_adapter.UpdateCommand.Parameters.Add("@.HIS_SOCIO_ECO", OleDbType.VarChar).Value = his_socio_eco;

db_adapter.UpdateCommand.Parameters.Add("@.HIS_COMPORTEMENTALE", OleDbType.VarChar).Value = his_comportementale;

db_adapter.UpdateCommand.Parameters.Add("@.NOM", OleDbType.VarChar).Value =cbox_name.Text;

db_adapter.UpdateCommand.Connection.Open();

db_adapter.UpdateCommand.ExecuteNonQuery();

db_adapter.UpdateCommand.Connection.Close();

}

Without seeing any error messages it's hard to tell, however the first thing that stands out is the following:

sql_edit_record += "[Histoire comportementale] = ?";

sql_edit_record += "WHERE Nom = ?";

You should insert a space after the question mark on the first line, like so:

sql_edit_record += "[Histoire comportementale] = ? ";

sql_edit_record += "WHERE Nom = ?";

You may also find that you have to wrap the placeholders in single quotes where your table columns are of a textual datatype, for instance:

sql_edit_record += "[Histoire comportementale] = '?' ";

sql_edit_record += "WHERE Nom = '?'";

Is there a reason that you aren't using stored procedures to perform this task?

Chris

|||

Thanks for ur reply, the error is :

OleDBException was Unhandled

No value given for one or more required parameters.

Allthough I put the space after the ?.

|||

Sorry to state the obvious, but could the problem be that you haven't assigned values to all of the parameters?

Thanks
Chris

|||

Would an empty string("") raise such an error?