|
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?
|
|
|
|
|
Do you specify any SMTP server? Does the sender email correspond to a valid user that is allowed to send using that SMTP server?
If you don't specify an SMTP server, the one one the web server is used. Is it installed? Is it activated? Does your ISP allow sending mail using anything other than their SMTP server?
---
b { font-weight: normal; }
|
|
|
|
|
Here is some code I used to send an email, which works well for me. It is based on the .NET Framework v2.0
Dim myMessage As New System.Net.Mail.MailMessage()<br />
With myMessage<br />
.To.Add("destination Email Address here")<br />
.From = New System.Net.Mail.MailAddress("Your email address here", "your name here")<br />
.Subject = "Subject line text here"<br />
.Attachments.Add(New System.Net.Mail.Attachment("path of attachment here"))<br />
.Body = "Email message here"<br />
.IsBodyHtml = False<br />
End With<br />
<br />
Dim SmtpMail As New System.Net.Mail.SmtpClient<br />
With SmtpMail<br />
.Host = = "SMTP Server IP address or URL here"<br />
.DeliveryMethod = SmtpDeliveryMethod.Network<br />
'Credentials only required if your SMTP server requires User Name and Password<br />
.Credentials = New System.Net.NetworkCredential("Your STMP Server User Name", "Your STMP Server Password"))<br />
.Send(myMessage)<br />
End With
Also ensure your firewall, Anti-Virus etc allows data to be sent via port 25. I had a problem where my emails where not being sent and on infestigation I found the McAfee AV Enterprise blocked all outgoing traffic on port 25, unless it was listed in the exceptions to that particular rule.
Regards
Steve Jowett
|
|
|
|
|
I have a deployment project that includes 7 assemblies. The machine I have written this on works with no problem. I can build the deployment project and everything works just fine. I have all the assemblies in VSS and have checked them out onto another machine. When I try to build the deployment project I get the following error in the task list:
Could not find file 'C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\Deployment\.\MsiRedist\1033\MsiLoadr.Bin 'No Such Interface Supported'
Has anyone seen this before? Any help will be much appreciated!
Mondis
|
|
|
|
|
i am creating comments for my functions and generate XML help file
like this
Public Class FUNCTIONS
<VBXC_Summary("Function that read full name"), VBXC_Remarks("remark"), VBXC_Returns("Returns Full Name of string datatype")> _
Public Shared Function readAll(<VBXC_Param("pMiddleName", "First name of person string")>ByVal pFirstName As String, <VBXC_Param("pMiddleName", "Middle name of person string")> ByVal pMiddleName As String, <VBXC_Param("pMiddleName", "Last name of person string")> ByVal pLastName As String) As String
End Function
End Class
and XML file generated for this functions is like this
<?xml version="1.0" ?>
- <doc>
- <assembly>
<name>clb</name>
</assembly>
- <members>
- <member name="M:clb.FUNCTIONS.readAll(System.String,System.String,System.String)">
<param name="pFirstName">First name of person string</param>
<param name="pMiddleName">Last name of person string</param>
<param name="pLastName">n/a</param>
<summary>Function that read full name</summary>
<returns>Returns Full Name of string datatype</returns>
<remarks>remark</remarks>
</member>
</members>
</doc>
but when using that assenbly in my code, intellisence doesn't showup with any
help
Milan
|
|
|
|
|
I have created one thread. Started it. then in the middle I stopped the thread using thread.abort and after that I want to start the same thread from 0. My thread object is global on form. but when i restart it says that thread is already running or aborted. Any Solution ???
Please note I dont need resume and Stopped option. I want to start the thread as it was started for the first time.
Thanks for support
Rizwan Bashir
|
|
|
|
|
You can't do that. Once a thread is stopped, there is no restarting it. You have to kill it off and create a new one.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
I have been searching everywhere and i can't find this code...i have a program with a first form with registration, and i want it to open only the first time the program it's executed and then opens the login form. Can somebody help me please?
sanity it's just a phone call away
-- modified at 7:56 Monday 10th July, 2006
|
|
|
|
|
try this
<br />
Sub Main()<br />
<br />
'open the first form (i'm assuming it's a splash screen) <br />
Application.Run(frmSplash)<br />
<br />
'when frmSplash closes open the login form<br />
Application.Run(frmLogin)<br />
<br />
End Sub<br />
|
|
|
|
|
Maybe I have explained myself wrong.
After installing the program the first form that appears it's a form to register a user account, after that the form (login) will appear. The form for registration it's the one that i want to appear only the first time that the program is executed.
This is for a final project at my school...and there are somethings that i didn't learn :$
cumps
|
|
|
|
|
Do one thing. make registration form as first load form of the project. When you will come second time. on the load of Registration you will have the code that if it is already a registered version then
also define one object in global say
dim frmReg as object
me.hide
frmreg=me
dim frm as new frmLogon
frm.show()
on closing the main application ... you need to close
frmreg.dispose()
and your problem is solved.
Rizwan Bashir
|
|
|
|
|
Why not start your app with a Main sub instead of a form, where you could see how many logon accounts are created in your database. If the count equals zero the show the registration form. This would also mean if someone deleted all the logon accounts, the registration form would show again allowing a new admin account to be setup etc.
Steve Jowett
|
|
|
|