Click here to Skip to main content
15,889,176 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionRemove Javascript controls from export to excel - VB.Net Pin
technette22-Jan-10 14:00
technette22-Jan-10 14:00 
AnswerRe: Remove Javascript controls from export to excel - VB.Net Pin
Mycroft Holmes24-Jan-10 10:49
professionalMycroft Holmes24-Jan-10 10:49 
GeneralRe: Remove Javascript controls from export to excel - VB.Net Pin
technette25-Jan-10 8:22
technette25-Jan-10 8:22 
GeneralRe: Remove Javascript controls from export to excel - VB.Net Pin
Mycroft Holmes25-Jan-10 10:30
professionalMycroft Holmes25-Jan-10 10:30 
GeneralRe: Remove Javascript controls from export to excel - VB.Net Pin
technette25-Jan-10 11:07
technette25-Jan-10 11:07 
GeneralRe: Remove Javascript controls from export to excel - VB.Net Pin
Mycroft Holmes25-Jan-10 12:00
professionalMycroft Holmes25-Jan-10 12:00 
GeneralRe: Remove Javascript controls from export to excel - VB.Net Pin
technette25-Jan-10 12:32
technette25-Jan-10 12:32 
QuestionI don't know why I have this error Pin
Curious 200922-Jan-10 5:51
Curious 200922-Jan-10 5:51 
What I try to do is reading any existed row in the table 'Info' (normally only 1 row existed) then update that row immediately, but I have an error when execute at cmd2.ExecuteNonQuery()

- However, if I move the If room_N > 0 Then out of the While loop & place it under lrd.Close() then it works OK! Can some one know the reason?

Dim ra As Integer
Dim cmd As New SqlCommand

Dim cnt_del As Integer
Dim room_N As Integer
Dim str As String

con.ConnectionString = strOpen
con.Open()

cmd.Connection = con
cmd.CommandText = "SELECT * FROM Info"
Dim lrd As SqlDataReader = cmd.ExecuteReader()

If lrd.HasRows Then

    Try
        'Dim lwr As SqlDataReader

        While lrd.Read()
            ListBox1.Items.Clear()

            str = lrd.GetValue(0).ToString() + ","
            str = str + lrd.GetValue(1).ToString() + ","
            str = str + lrd.GetValue(2).ToString() + ","
            str = str + lrd.GetValue(3).ToString() + ","
            str = str + lrd.GetValue(4).ToString() + ","
            str = str + lrd.GetValue(5).ToString()+ ","
            str = str + lrd.GetValue(6).ToString()

            ListBox1.Items.Insert(cnt_del, str)
            cnt_del = cnt_del + 1

            ListBox_Available.Items.Clear()
            room_N = SearchAvailableRooms(lrd.GetValue(2), lrd.GetValue(3), lrd.GetValue(4), lrd.GetValue(0), lrd.GetValue(1))

            If room_N > 0 Then
                cmd.CommandText = "UPDATE Reservations SET AvailRoomsRates = 'Trials'"
                cmd.ExecuteNonQuery()
            End If

        End While

        lrd.Close()


    Catch ex As Exception
        cnt_error = cnt_error + 1
        TextBox_Error.Text = cnt_error.ToString()
    End Try
End If

con.Close() 'Whether there is error or not. Close the connection.

AnswerRe: I don't know why I have this error Pin
DJ Matthews22-Jan-10 6:01
DJ Matthews22-Jan-10 6:01 
GeneralRe: I don't know why I have this error Pin
Curious 200922-Jan-10 6:33
Curious 200922-Jan-10 6:33 
AnswerRe: I don't know why I have this error Pin
loyal ginger22-Jan-10 6:31
loyal ginger22-Jan-10 6:31 
GeneralRe: I don't know why I have this error Pin
Curious 200922-Jan-10 6:39
Curious 200922-Jan-10 6:39 
GeneralRe: I don't know why I have this error Pin
loyal ginger22-Jan-10 7:10
loyal ginger22-Jan-10 7:10 
GeneralRe: I don't know why I have this error Pin
Curious 200922-Jan-10 7:35
Curious 200922-Jan-10 7:35 
GeneralRe: I don't know why I have this error Pin
loyal ginger22-Jan-10 7:44
loyal ginger22-Jan-10 7:44 
GeneralRe: I don't know why I have this error Pin
Curious 200922-Jan-10 8:49
Curious 200922-Jan-10 8:49 
QuestionDatabase record to textboxes Pin
offroaderdan22-Jan-10 5:06
offroaderdan22-Jan-10 5:06 
AnswerRe: Database record to textboxes Pin
Eddy Vluggen23-Jan-10 5:48
professionalEddy Vluggen23-Jan-10 5:48 
QuestionHow can I import table from one database to another thru a from in VB.net Pin
waner michaud22-Jan-10 3:30
waner michaud22-Jan-10 3:30 
AnswerRe: How can I import table from one database to another thru a from in VB.net Pin
Eddy Vluggen23-Jan-10 5:04
professionalEddy Vluggen23-Jan-10 5:04 
GeneralRe: How can I import table from one database to another thru a from in VB.net Pin
waner michaud23-Jan-10 7:23
waner michaud23-Jan-10 7:23 
GeneralRe: How can I import table from one database to another thru a from in VB.net Pin
Eddy Vluggen24-Jan-10 1:36
professionalEddy Vluggen24-Jan-10 1:36 
GeneralRe: How can I import table from one database to another thru a from in VB.net Pin
waner michaud25-Jan-10 4:12
waner michaud25-Jan-10 4:12 
GeneralRe: How can I import table from one database to another thru a from in VB.net Pin
Eddy Vluggen25-Jan-10 7:58
professionalEddy Vluggen25-Jan-10 7:58 
GeneralRe: How can I import table from one database to another thru a from in VB.net Pin
waner michaud25-Jan-10 8:10
waner michaud25-Jan-10 8: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.