I'm building a photo album. So, I want a photo to belong to a certain user. How can I get User ID?
var com = new SqlCommand("Insert into Photos (Photo, DatePublished, UserId)" +
"values (@Photo, @DatePublished, @UserId)", con);
com.Parameters.AddWithValue("@Photo", pic);
com.Parameters.AddWithValue("@DatePublished", DateTime.Today);
com.Parameters.AddWithValue("@UserId", //what should be written here?);
con.Open();
com.ExecuteNonQuery();
lblStatus.Text = "Image Uploaded Sucessfully";
Or can you point out some other way to do this kind of belonging? Thank you.
Aucun commentaire:
Enregistrer un commentaire