|
thanks milanatdigi,
Your solution was helpful. While the Solution provided by other guys created the same error message but i really appreciate their help as well.
thanks,
Sanded
|
|
|
|
|
my application is actually a web application where i manually upload CSV file to the database.but i want to automate the process,so i have thought of a second stage to this application i.e through a windows application i would download the CSV file from the NSEIndia.com site automatically and then upload the same to SQLServer on the server.i am facing a problem with upload i.e exporting the data to the database.it would be a great help to me if any one could provide me a solution either in VB.Net code or C# code.
AMIT(TATA CMC)
-- modified at 1:47 Tuesday 11th July, 2006
|
|
|
|
|
Hi All ,
I'm new in VB6.I have some doubts regarding forms.Basically my project consist of 2 forms(Form1 & Form2).Form1 is working perfectly fine.But when Form2 is load,the functions in it tends to slow down.But the codes is the same as Form1.Anyone met this prob before?I tried setting the timer faster but the outcome is the same.Thanks in advance.
|
|
|
|
|
Never heard of the problem before. There's go to to be something in your code that's doing it. You mentioned Timers? Are you doing things on both forms at the same time? This might have something to do with it...
Why are you learning VB6?? It's pretty much a dead product. You can get VB.NET 2005 Express Edition for free here[^].
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Oh,i know VB.NET is a more updated version.But i'm handling a project that
is previously done by other people.He uses VB6 so i have to continue with it.
Regarding the timers,at only 1 time,only an event is executed.But i have set timer6 in Form1 as well as Form2.After proceeding from Form1 to Form2,i hope that the events at Form1 won't be executed.But i also don't want to unload it as i need it at a later part.I cant possibly declare all timers disabled at Form2 as there are a large number of timers at Form1.So i hope someone can help me with this.Thanks alot.
|
|
|
|
|
K718 wrote: as there are a large number of timers at Form1
Uhhh, yeah. You might have found your problem.
Your explanation of what each form is doing is far from useful. All I know is that your using a large number of Timers, which is not a good idea. Since every one of those timers is firing it's "Tick" event on the UI thread, your Timers are probably bogging down your entire application.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hmm...as my proj need quite alot of functions,so i need to use so many timers.For Form1,i'm using Timer6 to make numbers selection.For Form2,i'm also using Timer6.It is the same codes but its the running of the contents that is different.Form1 is working fine(with some minor errors) but Form2 tends to be slower in reacting that causes distorted output.I set the timer interval faster but there isn't any difference.So what could be due to?Thanks alot.
|
|
|
|
|
K718 wrote: i'm using Timer6
Whats a "Timer6"?
Without seeing any of your code, it's impossible to understand what your trying to describe.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Hi,
I am getting this error when I try to add null to the value. Operator is not valid for type DBNull and type Date. Not sure how to fix this issue. I tried everything I could, but with no luck. Any help will be appreciated. Thanks
This is the code I have so far, which is causing the error.
comm.CommandText = "Update testbackup set datein = (null) & timein = (null) where barcodeid = '" & DgDisplay.Item(DgDisplay.CurrentRowIndex, 0).ToString & "'"<br />
comm.ExecuteNonQuery()
|
|
|
|
|
I'm not sure there's a way to specify DBNull in a string, perhaps you need to write a stored proc ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
What excatly would I write. Would you be able to help me with that like get me started on the right track. Appreciate it. Thanks
|
|
|
|
|
Assuming you're using SQL Server, something like:
CREATE PROC ClearBackup @id nvarchar(20)
as
Update testbackup set datein = null & timein = null where barcodeid = @id
go
will create the proc. Change nvarchar(20) to whatever type your ID is ( why is it not a number ? )
Then you can execute it from code, and pass in the ID.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I am using access as my back end for database. I am not using SQL server. Sorry for not letting you know before. Does that change now and how
|
|
|
|
|
Access allows stored procs nowadays, I believe, but I don't know the exact way to create them.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Alright. Well thanks for your help. I don't know how to create them either. Hope somebody can help me. Really appreciate your help so far though.
|
|
|
|
|
|
Sorry about not writing in my first post that I am using access as my database. I am not using SQL server. How will the code change and also I am using vb.net 2003 version. Thanks
|
|
|
|
|
|
I tried your suggestion and it still did not work. I have a feeling where I have put the code is in the wrong place. In the database barcodeid is a text field. In access database it is a text field. I will paste the code that I have for that button. Thanks for your help again.
Private Sub btnUpdateOSSF_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdateOSSF.Click<br />
Dim changes As Integer<br />
Dim commandBuilder As New OleDb.OleDbCommandBuilder(dataadapter)<br />
Dim i As String<br />
<br />
Dim str As String<br />
Dim comm As New OleDbCommand<br />
<br />
OleDbConnection1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _<br />
"Data Source=" & Application.StartupPath & "\backup.mdb;"<br />
<br />
comm.Connection = OleDbConnection1<br />
<br />
<br />
Me.BindingContext(dt).EndCurrentEdit()<br />
<br />
Dim strWrk As String = dt.Rows(0).Item("DateIN") = DateTimePicker1.Value<br />
Dim strWrk1 As String = dt.Rows(0).Item("TimeIN") = DateTimePicker2.Value<br />
<br />
<br />
changes = dataadapter.Update(dt)<br />
<br />
If changes > 0 Then<br />
MsgBox(changes & " changed rows were stored in the database.")<br />
Else<br />
MsgBox("No changes made.")<br />
End If<br />
<br />
<br />
Try<br />
OleDbConnection1.Open()<br />
<br />
'Copy existing record from original table to history table. <br />
comm.CommandText = "INSERT INTO History (barcodeid, Dateout, timeout, location, comments) SELECT barcodeid, Dateout, timeout, location, comments FROM testbackup WHERE barcodeid='" & DgDisplay.Item(DgDisplay.CurrentRowIndex, 0).ToString & "'"<br />
comm.ExecuteNonQuery()<br />
<br />
'Delete old history record.<br />
comm.CommandText = "DELETE FROM history WHERE (barcodeid = '" & DgDisplay.Item(DgDisplay.CurrentRowIndex, 0).ToString & "') AND (ID NOT IN (SELECT TOP 5 ID FROM history where barcodeid = '" & DgDisplay.Item(DgDisplay.CurrentRowIndex, 0).ToString & "' ORDER BY ID Desc))"<br />
comm.ExecuteNonQuery()<br />
<br />
<br />
comm.CommandText = "Update testbackup set datein = null, timein = null where barcodeid = ?"<br />
If DgDisplay.CurrentRowIndex < 0 Then<br />
comm.Parameters.Add("", DBNull.Value)<br />
Else<br />
comm.Parameters.Add("", DgDisplay.Item(DgDisplay.CurrentRowIndex, 0).ToString)<br />
End If<br />
<br />
comm.ExecuteNonQuery()<br />
<br />
Catch ex As Exception<br />
MsgBox(ex.Message)<br />
Err.Clear()<br />
Finally<br />
OleDbConnection1.Close()<br />
End Try<br />
<br />
dt.Clear()<br />
txtBarcodeID.Clear()<br />
End Sub
|
|
|
|
|
Hi guys
I am working on a ListView control and i want to move the items up and down. I already have applied the logic and it is successfull but with a problem as it works best when moving the item up either single item or multiple items but when i move the item down then if single then it works perfectly but in the case of moveing down multiple items then it fails. Here is the code:
For moving the item down:-
Private Sub movedown()
If Not ListView1.SelectedItems.Count = 0 Then
Dim myItem As Integer
For Each myItem In ListView1.SelectedIndices
If myItem = ListView1.Items.Count - 1 Then
Exit Sub
Else
Dim myitem2 As New ListViewItem
myitem2 = ListView1.Items.Item(myItem)
ListView1.Items.RemoveAt(ListView1.Items.IndexOf(myitem2))
ListView1.Items.Insert(myItem + 1, myitem2)
End If
Next
End If
End Sub
For moving the item Up:-
Private Sub moveup()
If Not ListView1.SelectedItems.Count = 0 Then
Dim myItem As Integer
For Each myItem In ListView1.SelectedIndices
If myItem = 0 Then
Exit Sub
Else
Dim myitem2 As New ListViewItem
myitem2 = ListView1.Items.Item(myItem)
ListView1.Items.RemoveAt(myItem)
ListView1.Items.Insert(myItem - 1, myitem2)
End If
Next
End If
End Sub
Please guys provide me help in soling the problem.
Thanks.
MAP Tiger
Tiger Softwares
Software Designer and Developer
VB.NET, ASP.NET, VFP
-- modified at 15:54 Monday 10th July, 2006
|
|
|
|
|
For moving down single or multiple selection, You can use following codes
Dim myitem As Int16
Dim i As Int16 = 0
For Each myitem In ListView1.SelectedIndices
If myitem = ListView1.Items.Count - 1 Then
Exit Sub
Else
Dim myitem2 As New ListViewItem
If i > 0 Then myitem = myitem - i
myitem2 = ListView1.Items.Item(myitem)
ListView1.Items.RemoveAt(ListView1.Items.IndexOf(myitem2))
ListView1.Items.Insert(ListView1.Items.Count, myitem2)
i = i + 1
End If
Next
Kumar Prabhakar
|
|
|
|
|
well it works but it moves the item to the last however the purpose is to move the item down one step.
So still the problem is on its place.
MAP Tiger
Tiger Softwares
Software Designer and Developer
VB.NET, ASP.NET, VFP
|
|
|
|
|
Well, I found the solution to the problem my self and here it is:
Dim col1 As ListView.SelectedIndexCollection = ListView1.SelectedIndices
For b As Integer = col1.Count - 1 To 0 Step -1
If col1.Item(b) = ListView1.Items.Count - 1 Then
Exit Sub
Else
Dim myitem As New ListViewItem
myitem = ListView1.Items.Item(col1.Item(b))
Dim a As Integer = col1.Item(b)
ListView1.Items.RemoveAt(col1.Item(b))
ListView1.Items.Insert(a + 1, myitem)
End If
Next
Thanks to all.
MAP Tiger
Tiger Softwares
Software Designer and Developer
VB.NET, ASP.NET, VFP
|
|
|
|
|
Hi,
I have windows application that logs into a secure website using HttpRequest and HttpResponse retrieves data and shows it to the user. It works fine under .net 1.1 but once i try it under .net2.0 it fails to log into the website. I doubled checked everything, it is identical except for one thing:
The URL it approaches last before succeeding/failing in logging in looks like:
/ICSLogin/?"https://someWebSite/" IN .NET1.1
/ICSLogin/?%22https://someWebSite/%22 IN .NET2.0
note the " is changed to %22
in 2.0 the response is 404 - page not found
my guess it has something to do with encoding but i can't figure out what.
Any ideas?
Thanks.
|
|
|
|
|
I am trying to send an email through a vb.net application to my email account. The code looks something like this:
SmtpMail.Send(global.EmailFrom, "my email address", subject, Body)
It does not error out but I do not get an email. Any ideas?
|
|
|
|