|
And to be sure you won't be screwed over by the regional settings on any PC it's on, format it in yyyy-mm-dd format.
-------------------------------------------
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Just bugger off and leave me alone!!
|
|
|
|
|
since you already have the day,month,year seperatly this might be the easist way to do it
Dim month As Integer = 12<br />
Dim year As Integer = 1983<br />
Dim day As Integer = 3<br />
Dim d As Date<br />
d = New Date(Year, Month, Day)
|
|
|
|
|
It is, there is no point in turning it into a string first, and then
get into trouble about regional settings...
|
|
|
|
|
Thanks 4 all the help!!
|
|
|
|
|
Thanx a million TDDragon, it works... although i just took out the values, and made the integers to string values..and
the variable d is deducted from current date.. THANK You!!!!
THANK YOU!!
THANK YOU!!
|
|
|
|
|
always glad to help someone
|
|
|
|
|
Datediff, google it, it's the right way to do it: something like:
DateDiff(FirstDate, SecondDate)
|
|
|
|
|
can any tell me how simplest of way to find whether a string exists in a file.
for eg.I have file tat ends with "}" I have to close the file ,if tat exists
Thanks in advance
|
|
|
|
|
If Instr(strYourString,strYourCharacter) > 0 Then
End if
David Loring
!! Keep Music Live !!
|
|
|
|
|
if yourstring.contains("yourchar") then
|
|
|
|
|
actually i want to open a file and search if "}" exists.
|
|
|
|
|
dim textreader as textreader (or somthing like that )
do while not textreader.EOF
dim s as string = textreader.readline
if s.contains("}")then
'do somthing
end if
loop
|
|
|
|
|
Unless your file turns out to be very big, you could simplify a lot
and use File.ReadAllText method.
|
|
|
|
|
dim s as string = system.io.file.readalltext("C:\Example")
if s.contains("}") then
'do your actions
end if
|
|
|
|
|
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 !!
|
|
|
|
|
I always use stored procs so this may be incorrect but!
drowData.AcceptChanges()
This sets the changed rows to current rows and removes the changed flag on the row
sqldaData.Update(dsetData, "Dates")
This presumably updates the change rows (which you have set to current) into the databse - it cannot find any changed rows!
I suggest you remove
drowData.AcceptChanges()
|
|
|
|
|
Thanks for the reply. I had just reached that conclusion myself, so your reply confirmed my suspicions. I also normally used stored procs so this one off was a new venture!!
David Loring
!! Keep Music Live !!
|
|
|
|
|
Hello
I work With dataGridView and an Adapter plus the dataSet
But i don't know how to display th data in the datagridView
Can Someone Help me?
Thanks in advance
Assaf
|
|
|
|
|
Hi,
You can use following Code(Change it as per ur requirement):
"Dim con As New SqlClient.SqlConnection
Dim cmd As New SqlClient.SqlCommand
Dim adp As New SqlClient.SqlDataAdapter
Dim dv as New DataView
con.ConnectionString = "Provider=Microsoft.jet.oledb.4.0;Data Source=Path"
cmd.CommandType = CommandType.Text
cmd.CommandText = "select * from Table"
cmd.Connection = con
adp.SelectCommand = cmd
adp.Fill(ds)
dv = New DataView(ds.Tables(0))
DataGridView1.DataSource = dv"
Regards,
Paramhans Dubey.
|
|
|
|
|
Thank to repply
i try to use it but the data grid don't display data, this my code:
con.Open()
adap = New OleDbDataAdapter
adap.SelectCommand = cmd
adap.Fill(dtSet)
dView = New DataView(dtSet.Tables(0))
Me.DataGridView1.DataSource = dView
Thanks a lot
Assaf
|
|
|
|
|
Hello,
I am working on a windows application with MDI form(toolbars etc) containing the MDI child form displaying the record one at a time provided with navigation buttons in toolbar.
I am accesing the dll which conatains the functionality of Find. This dll displays a Find Form (windows Form). While using the Find functionalty, if user gets any message from Find form it gets displayed on Top. But any message that is from the Application i.e. MDI child, it is sometimes appearing behind the form.
Also any other forms getting opened are also going behind the Find Form.
Please let me know how should I bring these messages/Forms on Top?
|
|
|
|
|
hi all
i have 2 form
form1 and form2
i m trying to keep the form2 always active
how can i do it
|
|
|
|
|
I'm assuming that form2 is a child of form1 and is being shown modelessly ? You could put focus back onto form2 whenever it loses it, but if you do that, what's the point of it being modeless ? A form cannot be active if you're interacting with another one.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
my use of that form is as a toolbar
that's why i need to keep the form always active because without that i need to click twice first to activate the form and second to use the control on the form
|
|
|
|
|
That sounds odd to me, you should be able to click on a control in your form, and it should select the form and the control.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|