Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Data Binding / November 2004

Tip: Looking for answers? Try searching our database.

Update command

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gis - 15 Nov 2004 15:05 GMT
Hello,
I'm trying to update my database using the Update command.
By debugging I realized that the parameters are not being passed to the
stored procedure. All parameter values show with value = undefined, except
for EmployeeID, dtpDate and AreaReferenceID which are 2 combos and one date
time picker outside the grid. All parameters which datasource is in the grid
fail. No exception or error message is displayed. but nothing happens at
all..

the code:
private void btnSave_Click(object sender, System.EventArgs e)
{
// Commandos para el adaptador.
SqlConnection strConn = new SqlConnection(strConnection);
SqlCommand sqlUpdate = new SqlCommand("p_UpdateTimeRecording", strConn);
sqlUpdate.CommandType = CommandType.StoredProcedure;
sqlUpdate.Parameters.Add("@TimeRecordingID",SqlDbType.UniqueIdentifier, 0,
"TimeRecordingID");
sqlUpdate.Parameters.Add("@EmployeeID", cboName.SelectedValue.ToString());
sqlUpdate.Parameters.Add("@TRDate", dtpDate.Value);
sqlUpdate.Parameters.Add("@ProjectID", SqlDbType.UniqueIdentifier,0,
"ProjectID");
sqlUpdate.Parameters.Add("@TRActivityID", SqlDbType.UniqueIdentifier,0,
"TRActivityID");
sqlUpdate.Parameters.Add("@OfferID", SqlDbType.UniqueIdentifier,0, "OfferID");
sqlUpdate.Parameters.Add("@CTSAPID", SqlDbType.UniqueIdentifier,0, "CTSAPID");
sqlUpdate.Parameters.Add("@CaseNoID", SqlDbType.UniqueIdentifier,0,
"CaseNoID");
sqlUpdate.Parameters.Add("@Hours", SqlDbType.Real , 4 , "Hours");
sqlUpdate.Parameters.Add("@Comments", SqlDbType.Char, 235, "Comments");
sqlUpdate.Parameters.Add("@AreaReferenceID",
cboArea.SelectedValue.ToString());

daTimeRecording.UpdateCommand = sqlUpdate;
try
{
daTimeRecording.Update(dsTimeRecording.Tables["TimeRecording"]);
dsTimeRecording.AcceptChanges();
}
catch (Exception ex)
{
MessageBox.Show( ex.ToString());
}
}

Thx a lot! I hope someone can help =)
pls reply only to newsgroup
Sijin Joseph - 20 Nov 2004 05:58 GMT
Make sure that the column names in the dataset match excatly with what
you have given in the Prameters.Add() method.

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph

> Hello,
> I'm trying to update my database using the Update command.
[quoted text clipped - 43 lines]
> Thx a lot! I hope someone can help =)
> pls reply only to newsgroup
Jim Hughes - 21 Nov 2004 04:16 GMT
All of the parameters you mentioned that are working have valid values
assigned, but why are you quoting the fourth argument in most of the lines
like this one?

sqlUpdate.Parameters.Add("@OfferID", SqlDbType.UniqueIdentifier,0,
"OfferID");

In this case it is trying to set the @OfferID parameter value to the literal
text "OfferID" instead of a UniqueIdentifier value.

Remove the quotes!

> Hello,
> I'm trying to update my database using the Update command.
[quoted text clipped - 47 lines]
> Thx a lot! I hope someone can help =)
> pls reply only to newsgroup

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.