GaGlets Ierakstīts Decembris 8, 2011 Share Ierakstīts Decembris 8, 2011 Savam projektam izmantoju Visual Basic 2008 piedāvāto Datubāzes izveidošanas tūli. Problēma sekojoša: Veicot SQL UPATE funkicju, atjaunotās tabulas `atjaunojās kaut kur citur`. Grūti saprast bet tā nu tas ir, Aplūkojot tabulas izmantojot VB 2008 dati paliek tie paši, un ieslēdzot debug režīmu dati arī ir tie paši, bet ja kodā pievieno `Application.Restart()` tad debug režīms izslēdzas un dati nomainas uz vajadzīgajiem. Zinu, izklausās pēc slima suņa murgiem, bet jautājiet, ja kaut kas palika neskaidrs. Private Sub ToolStripButton3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton3.Click Application.Restart() End Sub Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1.Click If Me.TabControl1.SelectedIndex = 0 Then Try Dim values As Integer = TrackBar1.Value() Dim trola As Integer For trola = 0 To values - 1 If Form1.connection.State = ConnectionState.Open Then Form1.connection.Close() End If Form1.connection.ConnectionString = ("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\database\Database1.mdf;Integrated Security=True;User Instance=True") Form1.command.Connection = Form1.connection Form1.connection.Open() Form1.command.CommandText = "UPDATE [Table3] SET [Tablename] = '" & _ Me.TabControl1.TabPages.Item(0).Controls.Item("TextBox" & trola + 1).Text _ & "' WHERE [TableID] = " & trola + 1 Form1.command.ExecuteNonQuery() Next trola Catch ex As Exception MessageBox.Show("Error: " & ex.Message, "Saving data") Finally Form1.connection.Close() End Try ElseIf TabControl1.SelectedIndex = 1 Then Else MsgBox("Please, select appropriate tab to work with this button", vbOKOnly, "Wrong tab selected") End If End Sub Trololo, slēdziet ciet, atrisināju problēmu. Link to comment Share on other sites More sharing options...
Recommended Posts
Izveido kontu, vai pieraksties esošajā, lai komentētu
Jums ir jābūt šī foruma biedram, lai varētu komentēt tēmas
Izveidot jaunu kontu
Piereģistrējies un izveido jaunu kontu, tas būs viegli!
Reģistrēt jaunu kontuPierakstīties
Jums jau ir konts? Pierakstieties tajā šeit!
Pierakstīties tagad!