Click here to Skip to main content
15,891,761 members
Home / Discussions / C#
   

C#

 
GeneralRe: Create folder Pin
Robert Rohde29-Jun-06 4:19
Robert Rohde29-Jun-06 4:19 
QuestionBluetooth Pin
ah_jiang_927-Jun-06 21:43
ah_jiang_927-Jun-06 21:43 
AnswerRe: Bluetooth Pin
Gavin Roberts27-Jun-06 23:16
Gavin Roberts27-Jun-06 23:16 
QuestionDataGrid and DataGridView Pin
Alamzeb khan27-Jun-06 21:32
Alamzeb khan27-Jun-06 21:32 
AnswerRe: DataGrid and DataGridView Pin
Robert Rohde27-Jun-06 23:03
Robert Rohde27-Jun-06 23:03 
GeneralRe: DataGrid and DataGridView Pin
Alamzeb khan28-Jun-06 0:38
Alamzeb khan28-Jun-06 0:38 
GeneralRe: DataGrid and DataGridView Pin
Robert Rohde28-Jun-06 1:29
Robert Rohde28-Jun-06 1:29 
Questionneed to insert name in the database using method Pin
Mamphekgo27-Jun-06 20:30
Mamphekgo27-Jun-06 20:30 
hi.i am struggling to insert name in the database using method.it gives me this error "Use of unassigned local variable 'empname'" and my code is as follows.


public void InsertValues(string empname1)
{

SqlConnection conn = new SqlConnection();
conn.ConnectionString = "integrated security=SSPI;initial catalog=Employee;server = za211149;persist security info=False";

conn.Open();

try
{
SqlCommand cmdInsert = new SqlCommand();
cmdInsert.Connection = conn;
empname = empname1;
cmdInsert.CommandText = "INSERT INTO jakes VALUES(@empname)";

cmdInsert.Parameters.Add(new SqlParameter("@empname",System.Data.SqlDbType.VarChar,50,"empname"));

cmdInsert.Parameters["@empname"].Value = empname.ToString();


if (cmdInsert.ExecuteNonQuery() !=0)
{
MessageBox.Show("Record inserted");
}
else
{
MessageBox.Show("record not inserted");
}
//return true;
}
catch(Exception E)
{

MessageBox.Show(E.ToString());
//return false;

}
finally
{
conn.Close();

}
}


AnswerRe: need to insert name in the database using method Pin
led mike27-Jun-06 20:44
led mike27-Jun-06 20:44 
GeneralRe: need to insert name in the database using method Pin
Mamphekgo27-Jun-06 21:12
Mamphekgo27-Jun-06 21:12 
GeneralRe: need to insert name in the database using method Pin
Mairaaj Khan27-Jun-06 22:32
professionalMairaaj Khan27-Jun-06 22:32 
GeneralRe: need to insert name in the database using method Pin
Michael P Butler28-Jun-06 1:56
Michael P Butler28-Jun-06 1:56 
GeneralRe: need to insert name in the database using method Pin
Mairaaj Khan28-Jun-06 3:33
professionalMairaaj Khan28-Jun-06 3:33 
QuestionMoving Toolstrip Like Toolstrip in MS Products Pin
praveenqwe27-Jun-06 20:12
praveenqwe27-Jun-06 20:12 
Questionpplication.SetCompatibleTextRenderingDefault(false); problem Pin
AngryC27-Jun-06 19:48
AngryC27-Jun-06 19:48 
AnswerRe: pplication.SetCompatibleTextRenderingDefault(false); problem Pin
led mike27-Jun-06 20:49
led mike27-Jun-06 20:49 
GeneralRe: pplication.SetCompatibleTextRenderingDefault(false); problem Pin
AngryC27-Jun-06 21:04
AngryC27-Jun-06 21:04 
QuestionValue Types and Structs Pin
Mairaaj Khan27-Jun-06 19:48
professionalMairaaj Khan27-Jun-06 19:48 
AnswerRe: Value Types and Structs Pin
Christian Graus27-Jun-06 20:15
protectorChristian Graus27-Jun-06 20:15 
AnswerRe: Value Types and Structs Pin
J4amieC27-Jun-06 21:59
J4amieC27-Jun-06 21:59 
GeneralRe: Value Types and Structs Pin
Mairaaj Khan28-Jun-06 3:53
professionalMairaaj Khan28-Jun-06 3:53 
GeneralRe: Value Types and Structs Pin
BoneSoft28-Jun-06 10:20
BoneSoft28-Jun-06 10:20 
GeneralRe: Value Types and Structs Pin
Mairaaj Khan28-Jun-06 20:42
professionalMairaaj Khan28-Jun-06 20:42 
GeneralRe: Value Types and Structs [modified] Pin
BoneSoft29-Jun-06 1:37
BoneSoft29-Jun-06 1:37 
Questionmonthcalendar control Pin
toink toink27-Jun-06 17:49
toink toink27-Jun-06 17:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.