Click here to Skip to main content
15,897,151 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Use a different dll for each project's form Pin
Eddy Vluggen14-Jun-16 10:11
professionalEddy Vluggen14-Jun-16 10:11 
QuestionVisual Basic and Access Database updating Pin
jbassmanp9-Jun-16 2:16
jbassmanp9-Jun-16 2:16 
QuestionRe: Visual Basic and Access Database updating Pin
ZurdoDev9-Jun-16 2:32
professionalZurdoDev9-Jun-16 2:32 
AnswerRe: Visual Basic and Access Database updating Pin
Dave Kreskowiak9-Jun-16 2:50
mveDave Kreskowiak9-Jun-16 2:50 
AnswerRe: Visual Basic and Access Database updating Pin
jbassmanp9-Jun-16 7:43
jbassmanp9-Jun-16 7:43 
QuestionApplication Portability Pin
BirderBob1-Jun-16 6:04
BirderBob1-Jun-16 6:04 
AnswerRe: Application Portability Pin
Dave Kreskowiak1-Jun-16 6:13
mveDave Kreskowiak1-Jun-16 6:13 
QuestionRecord does not get updated Pin
Raabi Anony30-May-16 18:19
Raabi Anony30-May-16 18:19 
Hello geeks

My struggle with Updating data seems never ending. My latest code is as below:
VB
Private Sub StaffInfoAdapterUpdate(ByVal conxnString As String)
   Dim cmdText As String
   cmdText = "SELECT StaffID, StaffName, blCampuses.CampusName, 
              Designation, DOB, Gender, NIC, DateOfJoining
     FROM tblStaffInfo
     INNER JOIN tblCampuses
     ON tblStaffInfo.CampusID = tblCampuses.CampusID"

     Using Conxn As SqlConnection = New SqlConnection(conxnString)

     Dim adapter As SqlDataAdapter = New SqlDataAdapter(cmdText, Conxn)
     Dim strUpdate As String = "UPDATE StaffName 
         SET StaffName = @StaffName " &  "WHERE StaffID = @StaffID"

            adapter.UpdateCommand = New SqlCommand(strUpdate, Conxn)
            adapter.UpdateCommand.Parameters.Add("@StaffName", SqlDbType.VarChar, 50, "StaffName")

     Dim parameter As SqlParameter =
     adapter.UpdateCommand.Parameters.Add("@StaffID", SqlDbType.Int)

            parameter.SourceColumn = "StaffID"
            parameter.SourceVersion = DataRowVersion.Original

            Dim StaffInfoTable As New DataTable
            Try
                adapter.Fill(StaffInfoTable)
                adapter.Update(StaffInfoTable)
            Catch ex As Exception
                MsgBox("Error: " & ex.Message)
            End Try
        End Using
    End Sub

When I modify the StaffName for testing, the code does not throw any error, but does not update the record either.
Please note that StaffID is the Primary Key of tblStaffInfo

Please help!
I have a point to clarify in this respect:
Do I have to include ALL the Fields in the strUpdate; which are included in cmdText string; even if most of the fields are least expected to be modified?
AnswerRe: Record does not get updated Pin
Richard Deeming1-Jun-16 2:26
mveRichard Deeming1-Jun-16 2:26 
GeneralRe: Record does not get updated Pin
Raabi Anony1-Jun-16 16:34
Raabi Anony1-Jun-16 16:34 
GeneralRe: Record does not get updated Pin
Richard Deeming2-Jun-16 1:48
mveRichard Deeming2-Jun-16 1:48 
GeneralRe: Record does not get updated Pin
Raabi Anony2-Jun-16 17:02
Raabi Anony2-Jun-16 17:02 
GeneralRe: Record does not get updated Pin
Chris Quinn2-Jun-16 21:06
Chris Quinn2-Jun-16 21:06 
GeneralRe: Record does not get updated Pin
Raabi Anony3-Jun-16 3:02
Raabi Anony3-Jun-16 3:02 
QuestionDynamic SQL generation is not supported against multiple base tables Pin
Raabi Anony29-May-16 17:17
Raabi Anony29-May-16 17:17 
AnswerRe: Dynamic SQL generation is not supported against multiple base tables Pin
Peter Leow29-May-16 17:57
professionalPeter Leow29-May-16 17:57 
GeneralRe: Dynamic SQL generation is not supported against multiple base tables Pin
Raabi Anony29-May-16 18:41
Raabi Anony29-May-16 18:41 
AnswerRe: Dynamic SQL generation is not supported against multiple base tables Pin
Mycroft Holmes29-May-16 22:19
professionalMycroft Holmes29-May-16 22:19 
GeneralRe: Dynamic SQL generation is not supported against multiple base tables Pin
Raabi Anony30-May-16 17:35
Raabi Anony30-May-16 17:35 
GeneralRe: Dynamic SQL generation is not supported against multiple base tables Pin
Mycroft Holmes30-May-16 19:08
professionalMycroft Holmes30-May-16 19:08 
GeneralRe: Dynamic SQL generation is not supported against multiple base tables Pin
Raabi Anony31-May-16 17:40
Raabi Anony31-May-16 17:40 
Questionadding values into a vb6 multiple-column list-box manually (in design time) Pin
Member 1250518129-May-16 9:27
Member 1250518129-May-16 9:27 
AnswerRe: adding values into a vb6 multiple-column list-box manually (in design time) Pin
Dave Kreskowiak29-May-16 18:42
mveDave Kreskowiak29-May-16 18:42 
AnswerRe: adding values into a vb6 multiple-column list-box manually (in design time) Pin
CHill601-Jun-16 0:50
mveCHill601-Jun-16 0:50 
QuestionAliasing Fieldnames and adding a calculation Field Pin
Raabi Anony27-May-16 18:10
Raabi Anony27-May-16 18:10 

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.