Click here to Skip to main content
15,921,113 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questiondatabase sql server2000 suspect? [modified] Pin
Phan Van Thao9-Oct-07 5:31
Phan Van Thao9-Oct-07 5:31 
AnswerRe: database sql server2000 suspect? Pin
Dave Kreskowiak9-Oct-07 6:24
mveDave Kreskowiak9-Oct-07 6:24 
AnswerRe: database sql server2000 suspect? Pin
GuyThiebaut9-Oct-07 8:29
professionalGuyThiebaut9-Oct-07 8:29 
Questionchange color of ProgressBar Pin
Sur4u9-Oct-07 5:23
Sur4u9-Oct-07 5:23 
AnswerRe: change color of ProgressBar Pin
Dave Kreskowiak9-Oct-07 6:23
mveDave Kreskowiak9-Oct-07 6:23 
QuestionSockets receive and send Pin
Nasbcn9-Oct-07 5:09
Nasbcn9-Oct-07 5:09 
AnswerRe: Sockets receive and send Pin
Dave Kreskowiak9-Oct-07 6:22
mveDave Kreskowiak9-Oct-07 6:22 
QuestionHow to Accept Parameters in this Situation Pin
Vimalsoft(Pty) Ltd9-Oct-07 4:10
professionalVimalsoft(Pty) Ltd9-Oct-07 4:10 
Hi All

i have a Function in my Component(DAL), the Function Accept an intiger value and return a dataset.

<br />
<br />
    Public Function Search_lis(ByVal lis_key As Integer) As Dssearchlis<br />
<br />
        dasearchlis.SelectCommand.Parameters.Add(lis_key)<br />
        dasearchlis.Fill(Dssearchlis)<br />
        If Dssearchlis.Tables("Property_Mass").Rows.Count = 0 Then<br />
            MsgBox("Township not Found")<br />
        Else<br />
            Dssearchlis.Clear()<br />
            dasearchlis.Fill(Dssearchlis)<br />
<br />
        End If<br />
        Return Dssearchlis<br />
    End Function<br />


Am Calling this Function in my Form. like this

Dim objsearch As New PropDAL.Properties
        Dim dsdata As New PropDAL.dssearchlis
        Dim txtseachlis As Integer
        txtseachlis = Val(txtlisSearch.Text)
        Dim strErrorMsg As String
        Dim strerror As System.Data.SqlClient.SqlError
        Try

            dsdata = objsearch.Search_lis(txtseachlis)
            dgr.DataMember = "Property_Mass"
            dgr.DataSource = dsdata

        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


What is Wrong , and what should i put in mind when dealing with parameters, i know i should have used a storedProcedure, but for now i need to use this.

Thanks




Vuyiswa Maseko,

Sorrow is Better than Laughter, it may Sudden 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 Accept Parameters in this Situation Pin
SHatchard9-Oct-07 6:08
SHatchard9-Oct-07 6:08 
AnswerRe: How to Accept Parameters in this Situation Pin
Dave Kreskowiak9-Oct-07 6:16
mveDave Kreskowiak9-Oct-07 6:16 
QuestionCheck if changes exist? Pin
Mr Oizo9-Oct-07 3:38
Mr Oizo9-Oct-07 3:38 
AnswerRe: Check if changes exist? Pin
Vimalsoft(Pty) Ltd9-Oct-07 4:02
professionalVimalsoft(Pty) Ltd9-Oct-07 4:02 
AnswerRe: Check if changes exist? Pin
Dave Kreskowiak9-Oct-07 4:58
mveDave Kreskowiak9-Oct-07 4:58 
GeneralRe: Check if changes exist? Pin
Mr Oizo9-Oct-07 5:50
Mr Oizo9-Oct-07 5:50 
GeneralRe: Check if changes exist? Pin
Dave Kreskowiak9-Oct-07 6:12
mveDave Kreskowiak9-Oct-07 6:12 
GeneralRe: Check if changes exist? Pin
Mr Oizo9-Oct-07 9:06
Mr Oizo9-Oct-07 9:06 
GeneralRe: Check if changes exist? Pin
Dave Kreskowiak9-Oct-07 11:52
mveDave Kreskowiak9-Oct-07 11:52 
GeneralRe: Check if changes exist? Pin
Mr Oizo9-Oct-07 22:33
Mr Oizo9-Oct-07 22:33 
GeneralRe: Check if changes exist? Pin
Patrick Etc.10-Oct-07 9:43
Patrick Etc.10-Oct-07 9:43 
Questionread a txt file in visual basic Pin
Rinki Mukheraji9-Oct-07 2:18
Rinki Mukheraji9-Oct-07 2:18 
AnswerRe: read a txt file in visual basic Pin
pmarfleet9-Oct-07 2:34
pmarfleet9-Oct-07 2:34 
AnswerRe: read a txt file in visual basic Pin
Dave Kreskowiak9-Oct-07 4:47
mveDave Kreskowiak9-Oct-07 4:47 
QuestionREG: VB Pin
rajasekar.mpbs9-Oct-07 2:08
rajasekar.mpbs9-Oct-07 2:08 
AnswerRe: REG: VB Pin
Dave Kreskowiak9-Oct-07 4:44
mveDave Kreskowiak9-Oct-07 4:44 
GeneralRe: REG: VB Pin
mr_lasseter9-Oct-07 6:11
mr_lasseter9-Oct-07 6:11 

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.