J
jaYPee
i have created an sqldataadapter using a wizard and i can save it
using datagrid control but don't know how to save the data from
textbox. because i have a master detail form and the master form is
populated w/ textboxes while the detail form is populated w/ datagrid
control.
in my sqldataadapter this is the commandtext in updatecommand
UPDATE Students
SET IDNo = @IDNo, LastName = @LastName, FirstName =
@FirstName, MiddleName = @MiddleName, Gender = @Gender, Address =
@Address,
[Parent/Guardian] = @Param2, ProgramID =
@ProgramID, MajorID = @MajorID, Year = @Year, Section = @Section,
DateofBirth = @DateofBirth,
PlaceofBirth = @PlaceofBirth, Scholarship =
@Scholarship, ElemSchool = @ElemSchool, ESAddress = @ESAddress,
ESSchYear = @ESSchYear,
SecSchool = @SecSchool, SSAddress = @SSAddress,
SSSchYear = @SSSchYear
WHERE (IDNo = @Original_IDNo) AND (Address = @Original_Address OR
@Original_Address IS NULL AND Address IS NULL)
AND (DateofBirth = @Original_DateofBirth OR
@Original_DateofBirth IS NULL AND DateofBirth IS
NULL) AND (ESAddress = @Original_ESAddress OR
@Original_ESAddress IS NULL AND ESAddress IS
NULL) AND (ESSchYear = @Original_ESSchYear OR
@Original_ESSchYear IS NULL AND ESSchYear IS
NULL) AND (ElemSchool = @Original_ElemSchool OR
@Original_ElemSchool IS NULL AND ElemSchool IS
NULL) AND (FirstName = @Original_FirstName OR
@Original_FirstName IS NULL AND FirstName IS
NULL) AND (Gender = @Original_Gender OR
@Original_Gender IS NULL AND Gender IS NULL) AND
(LastName = @Original_LastName OR
@Original_LastName IS NULL AND LastName IS NULL)
AND (MajorID = @Original_MajorID OR
@Original_MajorID IS NULL AND MajorID IS NULL)
AND (MiddleName = @Original_MiddleName OR
@Original_MiddleName IS NULL AND MiddleName IS
NULL) AND ([Parent/Guardian] = N'@Original_Parent/Guardian' OR
N'@Original_Parent/Guardian' IS NULL AND
[Parent/Guardian] IS NULL) AND (PlaceofBirth = @Original_PlaceofBirth
OR
@Original_PlaceofBirth IS NULL AND PlaceofBirth
IS NULL) AND (ProgramID = @Original_ProgramID OR
@Original_ProgramID IS NULL AND ProgramID IS
NULL) AND (SSAddress = @Original_SSAddress OR
@Original_SSAddress IS NULL AND SSAddress IS
NULL) AND (SSSchYear = @Original_SSSchYear OR
@Original_SSSchYear IS NULL AND SSSchYear IS
NULL) AND (Scholarship = @Original_Scholarship OR
@Original_Scholarship IS NULL AND Scholarship IS
NULL) AND (SecSchool = @Original_SecSchool OR
@Original_SecSchool IS NULL AND SecSchool IS
NULL) AND (Section = @Original_Section OR
@Original_Section IS NULL AND Section IS NULL)
AND (Year = @Original_Year OR
@Original_Year IS NULL AND Year IS NULL);
SELECT IDNo, LastName, FirstName,
MiddleName, Gender, Address, [Parent/Guardian], ProgramID, MajorID,
Year, Section, DateofBirth,
PlaceofBirth,
Scholarship, ElemSchool, ESAddress, ESSchYear, SecSchool, SSAddress,
SSSchYear
FROM Students
WHERE (IDNo = @IDNo)
now how can i change this so the the value in my textboxes will be
save when i update the sqldataadapter?
this is the code i use to save the database
SqlDataAdapter1.Update(DsStudentCourse1)
SqlDataAdapter2.Update(DsStudentCourse1)
there is no problem w/ sqldataadapter2 since i used datagrid. the only
problem is the sqldataadapter1 since i use textboxes instead of
datagrid.
thanks in advance.
using datagrid control but don't know how to save the data from
textbox. because i have a master detail form and the master form is
populated w/ textboxes while the detail form is populated w/ datagrid
control.
in my sqldataadapter this is the commandtext in updatecommand
UPDATE Students
SET IDNo = @IDNo, LastName = @LastName, FirstName =
@FirstName, MiddleName = @MiddleName, Gender = @Gender, Address =
@Address,
[Parent/Guardian] = @Param2, ProgramID =
@ProgramID, MajorID = @MajorID, Year = @Year, Section = @Section,
DateofBirth = @DateofBirth,
PlaceofBirth = @PlaceofBirth, Scholarship =
@Scholarship, ElemSchool = @ElemSchool, ESAddress = @ESAddress,
ESSchYear = @ESSchYear,
SecSchool = @SecSchool, SSAddress = @SSAddress,
SSSchYear = @SSSchYear
WHERE (IDNo = @Original_IDNo) AND (Address = @Original_Address OR
@Original_Address IS NULL AND Address IS NULL)
AND (DateofBirth = @Original_DateofBirth OR
@Original_DateofBirth IS NULL AND DateofBirth IS
NULL) AND (ESAddress = @Original_ESAddress OR
@Original_ESAddress IS NULL AND ESAddress IS
NULL) AND (ESSchYear = @Original_ESSchYear OR
@Original_ESSchYear IS NULL AND ESSchYear IS
NULL) AND (ElemSchool = @Original_ElemSchool OR
@Original_ElemSchool IS NULL AND ElemSchool IS
NULL) AND (FirstName = @Original_FirstName OR
@Original_FirstName IS NULL AND FirstName IS
NULL) AND (Gender = @Original_Gender OR
@Original_Gender IS NULL AND Gender IS NULL) AND
(LastName = @Original_LastName OR
@Original_LastName IS NULL AND LastName IS NULL)
AND (MajorID = @Original_MajorID OR
@Original_MajorID IS NULL AND MajorID IS NULL)
AND (MiddleName = @Original_MiddleName OR
@Original_MiddleName IS NULL AND MiddleName IS
NULL) AND ([Parent/Guardian] = N'@Original_Parent/Guardian' OR
N'@Original_Parent/Guardian' IS NULL AND
[Parent/Guardian] IS NULL) AND (PlaceofBirth = @Original_PlaceofBirth
OR
@Original_PlaceofBirth IS NULL AND PlaceofBirth
IS NULL) AND (ProgramID = @Original_ProgramID OR
@Original_ProgramID IS NULL AND ProgramID IS
NULL) AND (SSAddress = @Original_SSAddress OR
@Original_SSAddress IS NULL AND SSAddress IS
NULL) AND (SSSchYear = @Original_SSSchYear OR
@Original_SSSchYear IS NULL AND SSSchYear IS
NULL) AND (Scholarship = @Original_Scholarship OR
@Original_Scholarship IS NULL AND Scholarship IS
NULL) AND (SecSchool = @Original_SecSchool OR
@Original_SecSchool IS NULL AND SecSchool IS
NULL) AND (Section = @Original_Section OR
@Original_Section IS NULL AND Section IS NULL)
AND (Year = @Original_Year OR
@Original_Year IS NULL AND Year IS NULL);
SELECT IDNo, LastName, FirstName,
MiddleName, Gender, Address, [Parent/Guardian], ProgramID, MajorID,
Year, Section, DateofBirth,
PlaceofBirth,
Scholarship, ElemSchool, ESAddress, ESSchYear, SecSchool, SSAddress,
SSSchYear
FROM Students
WHERE (IDNo = @IDNo)
now how can i change this so the the value in my textboxes will be
save when i update the sqldataadapter?
this is the code i use to save the database
SqlDataAdapter1.Update(DsStudentCourse1)
SqlDataAdapter2.Update(DsStudentCourse1)
there is no problem w/ sqldataadapter2 since i used datagrid. the only
problem is the sqldataadapter1 since i use textboxes instead of
datagrid.
thanks in advance.