Click here to Skip to main content
15,895,256 members
Home / Discussions / C#
   

C#

 
QuestionHow can a struct with no explicit constructor have uninitialized fields? Pin
JoeRip5-Nov-07 14:37
JoeRip5-Nov-07 14:37 
AnswerRe: How can a struct with no explicit constructor have uninitialized fields? Pin
Luc Pattyn5-Nov-07 14:44
sitebuilderLuc Pattyn5-Nov-07 14:44 
GeneralRe: How can a struct with no explicit constructor have uninitialized fields? Pin
JoeRip5-Nov-07 14:46
JoeRip5-Nov-07 14:46 
GeneralRe: How can a struct with no explicit constructor have uninitialized fields? Pin
Luc Pattyn5-Nov-07 15:34
sitebuilderLuc Pattyn5-Nov-07 15:34 
AnswerRe: How can a struct with no explicit constructor have uninitialized fields? Pin
PIEBALDconsult5-Nov-07 14:47
mvePIEBALDconsult5-Nov-07 14:47 
GeneralRe: How can a struct with no explicit constructor have uninitialized fields? Pin
JoeRip5-Nov-07 14:51
JoeRip5-Nov-07 14:51 
GeneralRe: How can a struct with no explicit constructor have uninitialized fields? Pin
PIEBALDconsult5-Nov-07 16:19
mvePIEBALDconsult5-Nov-07 16:19 
QuestionUpdating Primary Key Pin
serene joey5-Nov-07 14:26
serene joey5-Nov-07 14:26 
Hi experts,

(I hope I didn't post my question in the wrong category of the forum)
I am using in C#, Asp.Net, SQL Server for my project.
I have a situation whereby I need to update a primary key.

In my table, I have these columns:
[U]proj_id[/U], emp_name, emp_email

I have the following method

public static void updatePID(String newpid,String oldpid)
{
SqlConnection conn = new SqlConnection(connString);
SqlCommand comm = new SqlCommand("Update table_name set proj_id = newpid where proj_id = oldpid");
conn.Open();
comm.Connection = conn;
comm.Parameters.AddWithValue("@projectid", newpid);
comm.Parameters.AddWithValue("@projectid", oldpid);

comm.ExecuteNonQuery();
conn.Close();
}


I have a problem with the following two statements.
comm.Parameters.AddWithValue("@projectid", newpid);
comm.Parameters.AddWithValue("@projectid", oldpid);

My connection with the database and the variables "newpid" and "oldpid" values are correct.
May I know if there is any other methods to update a primary using the old primary key? Thank You in Advance.



serene

AnswerRe: Updating Primary Key Pin
PIEBALDconsult5-Nov-07 16:23
mvePIEBALDconsult5-Nov-07 16:23 
QuestionRe: Updating Primary Key Pin
serene joey5-Nov-07 18:41
serene joey5-Nov-07 18:41 
AnswerRe: Updating Primary Key Pin
Andrei Ungureanu5-Nov-07 20:03
Andrei Ungureanu5-Nov-07 20:03 
GeneralRe: Updating Primary Key Pin
serene joey5-Nov-07 20:44
serene joey5-Nov-07 20:44 
GeneralRe: Updating Primary Key Pin
PIEBALDconsult6-Nov-07 4:05
mvePIEBALDconsult6-Nov-07 4:05 
GeneralRe: Updating Primary Key Pin
serene joey11-Nov-07 20:10
serene joey11-Nov-07 20:10 
QuestionHooking Direct Api Pin
danzar5-Nov-07 13:16
danzar5-Nov-07 13:16 
QuestionMaking Project Pin
Sameh96140335-Nov-07 11:30
Sameh96140335-Nov-07 11:30 
AnswerRe: Making Project Pin
Paul Conrad5-Nov-07 15:25
professionalPaul Conrad5-Nov-07 15:25 
QuestionData not stored on pocket pc Pin
karanjsingh5-Nov-07 11:19
karanjsingh5-Nov-07 11:19 
QuestionThreadsafe "for" without lock() Pin
szolDat5-Nov-07 11:05
szolDat5-Nov-07 11:05 
AnswerRe: Threadsafe "for" without lock() Pin
Guffa5-Nov-07 12:07
Guffa5-Nov-07 12:07 
AnswerRe: Threadsafe "for" without lock() Pin
szolDat5-Nov-07 12:31
szolDat5-Nov-07 12:31 
GeneralRe: Threadsafe "for" without lock() Pin
PIEBALDconsult5-Nov-07 16:02
mvePIEBALDconsult5-Nov-07 16:02 
AnswerRe: Threadsafe "for" without lock() Pin
Guffa5-Nov-07 20:24
Guffa5-Nov-07 20:24 
GeneralRe: Threadsafe "for" without lock() Pin
szolDat6-Nov-07 21:38
szolDat6-Nov-07 21:38 
AnswerRe: Threadsafe "for" without lock() Pin
Guffa6-Nov-07 22:20
Guffa6-Nov-07 22:20 

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.