Advertisement
Advertisement
| 12.27.2007 at 10:06AM PST, ID: 23045243 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
|
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: |
SQL Server Table Update code:
Public Function UpdateSQlDB(ByVal MyDataSet As Object, ByVal MyDataAdapter As Object, ByVal MySQLTable As String) As Boolean
'This sub updates the SQl database.
'MyDataSet - name of the dataset that contains the datatable from which the SQL updates will be made
'MyDataAdapter - name of the data adapter to use for the update
'MySQLTable - name of the SQL Table dataset to end edits
Try
Me.BindingContext(MyDataSet, MySQLTable).EndCurrentEdit() 'Stop any current edits
MyDataAdapter.Update(MyDataSet) 'Update SQL Server database
Catch eConcurrency As DBConcurrencyException
MessageBox.Show("This record has been updated by another user. " & ControlChars.CrLf _
& "Exit the form, reselect the record, and redo your updates.", "DB Concurrency Error")
'The update failed
Return False
Catch eData As DataException
MessageBox.Show(eData.Message, "ADO.Net Error")
'The update failed
Return False
Catch eSQL As SqlException
Dim iError As Integer
Dim SQLErrors As SqlErrorCollection = eSQL.Errors
Dim sErrorSummary As String = String.Empty
For iError = 0 To SQLErrors.Count - 1
'Display a custom error msg for certain SQL errors otherwise display standard SQl error msg
Dim SQlErrorMsg
'If SQLErrors(iError).Number = 547 Then
'SQlErrorMsg = "Delete cancelled. History records must be deleted first."
'Else
SQlErrorMsg = SQLErrors(iError).Message
'End If
sErrorSummary = sErrorSummary & SQLErrors(iError).Number & " - " _
& SQlErrorMsg _
& ControlChars.CrLf
Next iError
MessageBox.Show(sErrorSummary, "SQL Server Error")
'The update failed
Return False
Catch eSystem As Exception
MessageBox.Show(eSystem.Message, "System Error")
'The update failed
Return False
End Try
'The update succeeded
Return True
End Function
SQL INSERT statement:
INSERT INTO Issue
(Description, Doc_URL, Orig_ID, Orig_Source_ID, Orig_Point_ID, Orig_Case_No, Response_To_ID, Response_Due_Date, Open_Date, Create_Date,
Last_Update_Date, Status_Activity_ID, Status_Activity_Date, Status, Status_Date)
VALUES (@Description,@Doc_URL,@Orig_ID,@Orig_Source_ID,@Orig_Point_ID,@Orig_Case_No,@Response_To_ID,@Response_Due_Date,@Open_Date,@Create_Date,@Last_Update_Date,@Status_Activity_ID,@Status_Activity_Date,@Status,@Status_Date)
SQL UPDATE statement (auto-generated from VS2005 for dataadapter):
UPDATE Issue
SET Description = @Description, Doc_URL = @Doc_URL, Orig_ID = @Orig_ID, Orig_Source_ID = @Orig_Source_ID, Orig_Point_ID = @Orig_Point_ID,
Orig_Case_No = @Orig_Case_No, Response_To_ID = @Response_To_ID, Response_Due_Date = @Response_Due_Date, Open_Date = @Open_Date,
Create_Date = @Create_Date, Last_Update_Date = @Last_Update_Date, Status_Activity_ID = @Status_Activity_ID,
Status_Activity_Date = @Status_Activity_Date, Status = @Status, Status_Date = @Status_Date
WHERE (ID = @Original_ID) AND (Description = @Original_Description) AND (@IsNull_Doc_URL = 1 AND Doc_URL IS NULL OR
Doc_URL = @Original_Doc_URL) AND (@IsNull_Orig_ID = 1 AND Orig_ID IS NULL OR
Orig_ID = @Original_Orig_ID) AND (@IsNull_Orig_Source_ID = 1 AND Orig_Source_ID IS NULL OR
Orig_Source_ID = @Original_Orig_Source_ID) AND (@IsNull_Orig_Point_ID = 1 AND Orig_Point_ID IS NULL OR
Orig_Point_ID = @Original_Orig_Point_ID) AND (@IsNull_Orig_Case_No = 1 AND Orig_Case_No IS NULL OR
Orig_Case_No = @Original_Orig_Case_No) AND (@IsNull_Response_To_ID = 1 AND Response_To_ID IS NULL OR
Response_To_ID = @Original_Response_To_ID) AND (@IsNull_Response_Due_Date = 1 AND Response_Due_Date IS NULL OR
Response_Due_Date = @Original_Response_Due_Date) AND (@IsNull_Open_Date = 1 AND Open_Date IS NULL OR
Open_Date = @Original_Open_Date) AND (@IsNull_Create_Date = 1 AND Create_Date IS NULL OR
Create_Date = @Original_Create_Date) AND (@IsNull_Last_Update_Date = 1 AND Last_Update_Date IS NULL OR
Last_Update_Date = @Original_Last_Update_Date) AND (@IsNull_Status_Activity_ID = 1 AND Status_Activity_ID IS NULL OR
Status_Activity_ID = @Original_Status_Activity_ID) AND (@IsNull_Status_Activity_Date = 1 AND Status_Activity_Date IS NULL OR
Status_Activity_Date = @Original_Status_Activity_Date) AND (@IsNull_Status = 1 AND Status IS NULL OR
Status = @Original_Status) AND (@IsNull_Status_Date = 1 AND Status_Date IS NULL OR
Status_Date = @Original_Status_Date)
|