Click here to Skip to main content
16,007,687 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralExtract icon from dropdown Pin
cstrader2329-Jan-08 4:33
cstrader2329-Jan-08 4:33 
GeneralRe: Extract icon from dropdown Pin
Dave Kreskowiak9-Jan-08 4:48
mveDave Kreskowiak9-Jan-08 4:48 
GeneralRe: Extract icon from dropdown Pin
cstrader2329-Jan-08 5:30
cstrader2329-Jan-08 5:30 
GeneralRe: Extract icon from dropdown Pin
Dave Kreskowiak9-Jan-08 6:49
mveDave Kreskowiak9-Jan-08 6:49 
QuestionPlease help with Error in VB.Net Code :-( Pin
Support1239-Jan-08 3:13
Support1239-Jan-08 3:13 
GeneralRe: Please help with Error in VB.Net Code :-( Pin
Dave Kreskowiak9-Jan-08 4:19
mveDave Kreskowiak9-Jan-08 4:19 
GeneralRe: Please help with Error in VB.Net Code :-( Pin
Support1239-Jan-08 17:36
Support1239-Jan-08 17:36 
QuestionHow to update a datagrid from a Command builder Pin
Vimalsoft(Pty) Ltd9-Jan-08 0:45
professionalVimalsoft(Pty) Ltd9-Jan-08 0:45 
hi all i have this function in my DAl that returns a dataset like this

Public Function Get_Data_Straight(ByVal strNumkey As String) As DataSet
      Dim strSQl As String = "SELECT Primary_ID, Boundary_area, Attrib_Code, Lis_Key, Func_Key, Actual_Extent, Improved_Value, Site_Value, Purchase_price, Purchase_date, prop_id, confidence_score, fin_ls_prediction, new_lis_key, new_func_key, Tshwane_Prediction, matchflag, source, flagtype, Locked FROM Property_mass WHERE (SUBSTRING(Lis_Key, 1, 4) = @Lis_key) AND (Locked IS NULL)"
      Dim constr As String = "user id=sde;Password=@@@@@@;Server=@@@@@@@@;persist security info=False;initial catalog=Tshwane_Valuations_Train"
      Dim cmb As SqlCommandBuilder
      Dim con As SqlConnection
      Dim da As SqlDataAdapter
      Dim cmd As SqlCommand

      Dim ds As DataSet
      Try

          ds = New DataSet
          con = New SqlConnection(constr)
          con.Open()
          'Inituializing the Connection Object
          cmd = New SqlCommand(strSQl)

          'Telling the connection object where is the Database
          cmd.Connection = con
          'Initializing the adapter
          da = New SqlDataAdapter

          'we tell the adapter which object we are using
          da.SelectCommand = cmd
          da.SelectCommand.Parameters.Add("@Lis_key", strNumkey)
          ' da.SelectCommand.Parameters.Add(New SqlParameter("@Lis_Key", strNumkey))
          ds.Clear()
          da.Fill(ds, "Property_Mass")
      Catch ex As SqlClient.SqlException

          MsgBox(ex.Message)

      End Try
      Return ds

  End Function


and i display the results into the datagrid. well everything is working well. do i want to update the Grid when a change has been made. As Commandbuilder will generate a update query for me, i want to know, how am i going to use the commandbuilder in another function in the Dal that will be used to save the changes. is it ok, the way i have declared the command builder locally into the function, or should i make it a shared object so that the other function can access it when it want to update, or the other function is Supposed to create its own command builder.

The below is my update Function in my DAL

Public Sub UpdateLis_search_Straight(ByVal dsData As DataSet)
    'update data in the actual database
    Dim strSQl As String = "SELECT Primary_ID, Boundary_area, Attrib_Code, Lis_Key, Func_Key, Actual_Extent, Improved_Value, Site_Value, Purchase_price, Purchase_date, prop_id, confidence_score, fin_ls_prediction, new_lis_key, new_func_key, Tshwane_Prediction, matchflag, source, flagtype, Locked FROM Property_mass WHERE (SUBSTRING(Lis_Key, 1, 4) = @Lis_key) AND (Locked IS NULL)"
    Dim constr As String = "user id=sde;Password=@@@@@@;Server=@@@@@@;persist security info=False;initial catalog=Tshwane_Valuations_Train"
    Dim cmb As SqlCommandBuilder
    Dim con As SqlConnection
    Dim da As SqlDataAdapter
    Dim cmd As SqlCommand
    Try
        da.UpdateCommand = cmb.GetUpdateCommand
        da.Update(dsData)
        'adpAccess.Update(dtbschemaDatabases)
    Catch ex As SqlClient.SqlException
        MsgBox(ex.Message)


    End Try
End Sub


PLease help

Thanks

Vuyiswa Maseko,

Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding

VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za


AnswerRe: How to update a datagrid from a Command builder Pin
Dave Kreskowiak9-Jan-08 4:14
mveDave Kreskowiak9-Jan-08 4:14 
GeneralRe: How to update a datagrid from a Command builder Pin
Vimalsoft(Pty) Ltd9-Jan-08 4:21
professionalVimalsoft(Pty) Ltd9-Jan-08 4:21 
GeneralRe: How to update a datagrid from a Command builder Pin
Dave Kreskowiak9-Jan-08 5:02
mveDave Kreskowiak9-Jan-08 5:02 
Questionmp3 steganography Pin
thanmas9-Jan-08 0:38
thanmas9-Jan-08 0:38 
GeneralRe: mp3 steganography Pin
Dave Kreskowiak9-Jan-08 4:10
mveDave Kreskowiak9-Jan-08 4:10 
Generalsyntax highlighting in richtextbox Pin
balakpn9-Jan-08 0:32
balakpn9-Jan-08 0:32 
GeneralRe: syntax highlighting in richtextbox Pin
Dave Kreskowiak9-Jan-08 4:09
mveDave Kreskowiak9-Jan-08 4:09 
QuestionNeed Help on Delegates Pin
Senthil S8-Jan-08 23:05
Senthil S8-Jan-08 23:05 
GeneralRe: Need Help on Delegates Pin
Dave Kreskowiak9-Jan-08 4:05
mveDave Kreskowiak9-Jan-08 4:05 
GeneralMonth&Year Pin
Priya S8-Jan-08 20:23
Priya S8-Jan-08 20:23 
GeneralRe: Month&Year Pin
Christian Graus8-Jan-08 20:43
protectorChristian Graus8-Jan-08 20:43 
GeneralRe: Month&Year Pin
Priya S8-Jan-08 20:56
Priya S8-Jan-08 20:56 
GeneralHelp to add CheckBox control to the flexgrid Pin
aaraaayen8-Jan-08 19:50
aaraaayen8-Jan-08 19:50 
GeneralRe: Help to add CheckBox control to the flexgrid Pin
Dave Kreskowiak9-Jan-08 3:58
mveDave Kreskowiak9-Jan-08 3:58 
GeneralDataTable and Labels... Pin
Illegal Operation8-Jan-08 19:11
Illegal Operation8-Jan-08 19:11 
GeneralRe: DataTable and Labels... Pin
Christian Graus8-Jan-08 19:21
protectorChristian Graus8-Jan-08 19:21 
GeneralRe: DataTable and Labels... Pin
Illegal Operation8-Jan-08 20:00
Illegal Operation8-Jan-08 20:00 

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.