Click here to Skip to main content
16,005,241 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionSearching a particular text Pin
Archana New to Dotnet2-Aug-07 1:37
Archana New to Dotnet2-Aug-07 1:37 
AnswerRe: Searching a particular text Pin
DA_Loring2-Aug-07 1:51
DA_Loring2-Aug-07 1:51 
AnswerRe: Searching a particular text Pin
Tom Deketelaere2-Aug-07 2:01
professionalTom Deketelaere2-Aug-07 2:01 
GeneralRe: Searching a particular text Pin
Archana New to Dotnet2-Aug-07 2:17
Archana New to Dotnet2-Aug-07 2:17 
GeneralRe: Searching a particular text Pin
Tom Deketelaere2-Aug-07 2:24
professionalTom Deketelaere2-Aug-07 2:24 
GeneralRe: Searching a particular text Pin
Luc Pattyn2-Aug-07 7:40
sitebuilderLuc Pattyn2-Aug-07 7:40 
AnswerRe: Searching a particular text Pin
The ANZAC2-Aug-07 11:19
The ANZAC2-Aug-07 11:19 
QuestionWriting data back to a table Pin
DA_Loring2-Aug-07 1:36
DA_Loring2-Aug-07 1:36 
This is probably very simple to answer, and I must be doing something very silly, but I just don't seem to be able to get changes in a dataset to write back to a table in the database. I have used stored procs up 'til now but this is a quick fix needed to join two columns, date and time, into one datetime column, and I just cannot get it to work. Here is the code:

Dim dsetData As New DataSet
Dim dteTemp1 As Date
Dim dteTemp2 As Date
Dim intRowCount As Integer = 1

Using sqlcnnData As New SqlConnection(m_strConnect)

Dim sqlcmdData As New SqlCommand("SELECT * FROM DDI_tbl_SystemDemandData", sqlcnnData)
sqlcmdData.CommandType = CommandType.Text

Dim sqldaData As New SqlDataAdapter(sqlcmdData)
Dim builder As SqlCommandBuilder = New SqlCommandBuilder(sqldaData)
builder.QuotePrefix = "["
builder.QuoteSuffix = "]"

sqldaData.Fill(dsetData, "Dates")
If dsetData.Tables(0).Rows.Count > 0 Then

Dim drowData As DataRow
For Each drowData In dsetData.Tables(0).Rows

dteTemp1 = DateValue(drowData("DataDateTime"))
dteTemp2 = drowData("DataTime")
dteTemp1 = dteTemp1.AddHours(Hour(dteTemp2))
If Minute(dteTemp2) > 0 Then
dteTemp1 = dteTemp1.AddMinutes(Minute(dteTemp2))
End If
drowData("DataDateTime") = dteTemp1
drowData.AcceptChanges()
Label1.Text = "Processed row " & intRowCount.ToString
Application.DoEvents()
intRowCount = intRowCount + 1
Next
dsetData.AcceptChanges()
intRowCount = intRowCount - 1
Label1.Text = "Completed. Processed " & intRowCount.ToString & " rows"

sqldaData.Update(dsetData, "Dates")
Else
Label1.Text = "FAILED"
End If

sqldaData.Dispose()
sqlcmdData.Dispose()

End Using
dsetData.Dispose()

I don't get any errors, it runs OK, but just does not do it! I any one can point me in the right direction I would be most grateful.


David Loring
!! Keep Music Live !!
AnswerRe: Writing data back to a table Pin
Mycroft Holmes3-Aug-07 15:07
professionalMycroft Holmes3-Aug-07 15:07 
GeneralRe: Writing data back to a table Pin
DA_Loring7-Aug-07 0:43
DA_Loring7-Aug-07 0:43 
QuestionDataGridView Pin
Assaf822-Aug-07 0:46
Assaf822-Aug-07 0:46 
AnswerRe: DataGridView Pin
Paramhans Dubey2-Aug-07 2:13
professionalParamhans Dubey2-Aug-07 2:13 
QuestionRe: DataGridView Pin
Assaf822-Aug-07 2:48
Assaf822-Aug-07 2:48 
QuestionWindows Forms and Messages Pin
rk4ps2-Aug-07 0:31
rk4ps2-Aug-07 0:31 
Questionhow to keep a form always active Pin
eyes20072-Aug-07 0:27
eyes20072-Aug-07 0:27 
AnswerRe: how to keep a form always active Pin
Christian Graus2-Aug-07 0:35
protectorChristian Graus2-Aug-07 0:35 
GeneralRe: how to keep a form always active Pin
eyes20072-Aug-07 0:42
eyes20072-Aug-07 0:42 
GeneralRe: how to keep a form always active Pin
Christian Graus2-Aug-07 1:31
protectorChristian Graus2-Aug-07 1:31 
GeneralRe: how to keep a form always active Pin
DA_Loring2-Aug-07 1:48
DA_Loring2-Aug-07 1:48 
GeneralRe: how to keep a form always active Pin
eyes20072-Aug-07 3:44
eyes20072-Aug-07 3:44 
GeneralRe: how to keep a form always active Pin
Dave Kreskowiak2-Aug-07 9:53
mveDave Kreskowiak2-Aug-07 9:53 
AnswerRe: how to keep a form always active Pin
Froz3n2-Aug-07 4:35
Froz3n2-Aug-07 4:35 
QuestionWindows forms and message box Pin
rk4ps2-Aug-07 0:25
rk4ps2-Aug-07 0:25 
AnswerRe: Windows forms and message box Pin
eyes20072-Aug-07 0:32
eyes20072-Aug-07 0:32 
GeneralRe: Windows forms and message box Pin
rk4ps2-Aug-07 0:58
rk4ps2-Aug-07 0:58 

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.