Click here to Skip to main content
15,886,873 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionIncorporate mutli-language in vb6 application Pin
takaz1231-Aug-07 23:06
takaz1231-Aug-07 23:06 
Questionwhat is wrong with the Following code Pin
Vimalsoft(Pty) Ltd1-Aug-07 23:05
professionalVimalsoft(Pty) Ltd1-Aug-07 23:05 
AnswerRe: what is wrong with the Following code Pin
Tom Deketelaere1-Aug-07 23:34
professionalTom Deketelaere1-Aug-07 23:34 
GeneralRe: what is wrong with the Following code Pin
Vimalsoft(Pty) Ltd2-Aug-07 2:10
professionalVimalsoft(Pty) Ltd2-Aug-07 2:10 
GeneralRe: what is wrong with the Following code Pin
Tom Deketelaere2-Aug-07 2:29
professionalTom Deketelaere2-Aug-07 2:29 
AnswerRe: what is wrong with the Following code Pin
Christian Graus2-Aug-07 0:25
protectorChristian Graus2-Aug-07 0:25 
AnswerRe: what is wrong with the Following code Pin
Paramhans Dubey2-Aug-07 2:26
professionalParamhans Dubey2-Aug-07 2:26 
GeneralRe: what is wrong with the Following code Pin
Vimalsoft(Pty) Ltd2-Aug-07 3:20
professionalVimalsoft(Pty) Ltd2-Aug-07 3:20 
Hi ParamHans

Thank you very much for your reply, after i removed the spaces as you will see in the folloeing code, i still got the Error that says
Object reference not set to an Instance of an Object.

The Following is my code in my form load, i thought if you can see my code, you will understand where does the Error comes from. thanks once more time.
       Dim strconnection As String = "workstation id=5875-049;packet size=4096;user id=****; Password=*****;data source= ********;persist security info=False;initial catalog=******_****"
        Dim cn As SqlConnection = New SqlConnection(strconnection)
        cn.Open()
        'set up data adapter 
        Dim strSql As String = _
" select Boundary_Area,Actual_Extent," _
& "Attrib_code,Lis_key,Func_key," _
& "Density,New_Net_Usable_Extent," _
& "New_Total_Land_Factor,New_AdJ_Extent_1," _
& "New_Points_1,New_ADJ_Extent_2," _
& "New_Points_2,Fin_Ls_Prediction," _
& "Confidence_score,Flagtype from Property_Mass"
        

        Dim da As SqlDataAdapter = New SqlDataAdapter(strSql, cn)
        'Declare and load the Data set
        Dim ds As DataSet = New DataSet
        da.Fill(ds, "Property_Mass")

        Dim strErrorMsg As String
        Dim strerror As System.Data.SqlClient.SqlError

        'set up data Adapter Object
        strSql = " select Property_Mass.Boundary_Area," _
        & "   Property_Mass.Actual_Extent," _
        & "   Property_Mass.Attrib_code, Property_Mass.Lis_key," _
        & "   Property_Mass.Func_key, Property_Mass.Density," _
        & "   Property_Mass.New_Net_Usable_Extent," _
        & "   Property_Mass.New_Total_Land_Factor," _
        & "   Property_Mass.New_AdJ_Extent_1,Property_Mass.New_Points_1," _
        & "   Property_Mass.New_ADJ_Extent_2,Property_Mass.New_Points_2," _
        & "   Property_Mass.Fin_Ls_Prediction,Property_Mass.Confidence_score," _
        & "   Property_Mass.Flagtype,Property_Summary.Purchase_Date," _
        & "   Property_Summary.Purchase_Price" _
        & "   from  Property_Mass , Property_Summary " _
        & "   where (Property_Mass.Lis_key = Property_Summary.Lis_key)"
        da = New SqlDataAdapter(strSql, cn)
        'load a Dataset 
        Try
            da.Fill(ds, "Property_Mass")
            'Close the Connection
            cn.Close()


            ds.Relations.Add("Property_summary_Mass", _
            ds.Tables("Property_Mass").Columns("Lis_key"), _
            ds.Tables("Property_Summary").Columns("Lis_key"))

            'Bind the data set to the grid.
            'Assumes that Grid contains a reference to a 
            'system.windows.datagrid
            DataGrid2.SetDataBinding(ds, "Property_Mass")
            'sorting the Datagrid
            DataGrid2.AllowSorting = True
        Catch ExSQL As System.Data.SqlClient.SqlException
            '''All this will trap all data Problems and Network if available
            For Each strerror In ExSQL.Errors
            Next
            Select Case strerror.Number
                Case 17
                    strErrorMsg = "Missing server"
                Case 4060
                    strErrorMsg = "Missing database"
                Case 18456
                    strErrorMsg = "Missing user name or password"
                Case Else
                    strErrorMsg = strerror.Message
            End Select
            MessageBox.Show(strErrorMsg, "SQL Server Error: " & strerror.Number, MessageBoxButtons.OK, MessageBoxIcon.Error)

        Catch ExcpInvOp As System.InvalidOperationException

            MessageBox.Show("Close the connection first!", "Invalid Operation", MessageBoxButtons.OK, MessageBoxIcon.Error)

        Catch Excp As System.Exception ' generic exception handler

            MessageBox.Show(Excp.Message, "Unexpected Exception", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub


Vuyiswa Maseko

GeneralRe: what is wrong with the Following code Pin
Tom Deketelaere2-Aug-07 4:05
professionalTom Deketelaere2-Aug-07 4:05 
AnswerRe: what is wrong with the Following code Pin
Vimalsoft(Pty) Ltd2-Aug-07 22:21
professionalVimalsoft(Pty) Ltd2-Aug-07 22:21 
QuestionUpdating the database with SqlDataAdapter Pin
HinJinShah1-Aug-07 22:56
HinJinShah1-Aug-07 22:56 
Questionhow can i recognise voice? Pin
Ashraf zia1-Aug-07 21:53
Ashraf zia1-Aug-07 21:53 
AnswerRe: how can i recognise voice? Pin
Christian Graus1-Aug-07 21:56
protectorChristian Graus1-Aug-07 21:56 
Questionsend data from a listbox to textbox Pin
sixecho1-Aug-07 21:41
sixecho1-Aug-07 21:41 
AnswerRe: send data from a listbox to textbox Pin
Christian Graus1-Aug-07 21:49
protectorChristian Graus1-Aug-07 21:49 
AnswerRe: send data from a listbox to textbox Pin
Tom Deketelaere1-Aug-07 23:36
professionalTom Deketelaere1-Aug-07 23:36 
QuestionUsing .NET dll in VB Script Pin
Amma123!!1-Aug-07 20:34
Amma123!!1-Aug-07 20:34 
AnswerRe: Using .NET dll in VB Script Pin
Christian Graus1-Aug-07 20:45
protectorChristian Graus1-Aug-07 20:45 
GeneralRe: Using .NET dll in VB Script Pin
Amma123!!2-Aug-07 5:01
Amma123!!2-Aug-07 5:01 
QuestionContext Menu in Textbox using VB Pin
nhss1-Aug-07 20:09
nhss1-Aug-07 20:09 
Questionwindow application deployment Pin
Sonia Gupta1-Aug-07 18:41
Sonia Gupta1-Aug-07 18:41 
AnswerRe: window application deployment Pin
Christian Graus1-Aug-07 18:58
protectorChristian Graus1-Aug-07 18:58 
GeneralRe: window application deployment Pin
Sonia Gupta1-Aug-07 22:43
Sonia Gupta1-Aug-07 22:43 
GeneralRe: window application deployment Pin
Christian Graus1-Aug-07 23:04
protectorChristian Graus1-Aug-07 23:04 
GeneralRe: window application deployment Pin
Sonia Gupta1-Aug-07 23:24
Sonia Gupta1-Aug-07 23:24 

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.