|
No. I've never had the problem. It sounds like your missing a step in your code, like not setting the Image property to Nothing after your dispose the Image?
You can see this[^] for an example.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have an Error after finish a msgbox line.
After I comment the line, it works fine.
The error is
An unhandled exception of type 'System.ArgumentException' Occured in system.windows.forms.dll
Additional information: Invalid parameter used.
What's wrong??
Thank you!
|
|
|
|
|
|
cylix2000 wrote: What's wrong??
With what? The thing you're holding behind your back?
Come on... If you're going to ask a question like "what's wrong with my code?", you have to show us the code that's throwing the exception!!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi, I am using the following code to update records in an access table using vb.net.
Dim dr As OleDbDataReader
Dim qry As New OleDbCommand
Dim ucon As New OleDbConnection
Dim inssql As String
inssql = "Update PriceTable set Price = " & newprice & " where ID = '" & id1 & "' and Period = '" & Trim(period) & "'"
qry = New OleDbCommand(inssql, ucon)
dr = qry.ExecuteScalar
What I want to check is if the query has been executed correctly. i.e. if id1 (id1 matches with ID from PriceTable) exists in PriceTable, then it will be executed successfully. However, if the id1 is not present in PriceTable (id1 does not match with ID in PriceTable), then how do I know that the qry has not been executed.
Please provide assistance ASAP.
With Best Regards,
Mayur
|
|
|
|
|
mayhem_rules wrote: qry.ExecuteScalar
shouldn't this be ExecuteNonQuery() ...
This is the statement that does Update , Insert and Delete .
It returns the number of rows affected.
Jesus Loves <marquee direction="up" height="40" scrolldelay="1" step="1" scrollamount="1" style="background:#aabbcc;border-bottom:thin solid 1px #6699cc">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
ExecuteNonQuery it returns no of rows effected by the query. use this:
Dim dr As OleDbDataReader<br />
Dim qry As New OleDbCommand<br />
Dim ucon As New OleDbConnection<br />
Dim inssql As String<br />
dim iNoofRows as interger<br />
<br />
inssql = "Update PriceTable set Price = " & newprice & " where ID = '" & id1 & "' and Period = '" & Trim(period) & "'"<br />
qry = New OleDbCommand(inssql, ucon)<br />
<br />
iNoofRows = qry.ExecuteNonQuery 'Instead of qry.ExecuteScalar<br />
<br />
|
|
|
|
|
Thnx guys for your reply. I will try out your solution. However, what I need to know is whether every execute statement is successfully completed. If not, then I need to maintain a log of the records (ID's, Price) which have not been executed successfully for the user to analyze. How can this be done.
Thnx again.
With Best Regards,
Mayur
-- modified at 1:43 Friday 20th January, 2006
|
|
|
|
|
mayhem_rules wrote: However, what I need to know is whether every execute statement is successfully completed.
That is what ExecuteNonQuery returns.
It returns the number of rows affected by the said query. So if it returns 0 it means no rows affected.
Jesus Loves <marquee direction="up" height="40" scrolldelay="1" step="1" scrollamount="1" style="background:#aabbcc;border-bottom:thin solid 1px #6699cc">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Thnx, I will try it out and let you know. Another query that I have is how do I maintain a log file to record all the transactions.
With Best Regards,
Mayur
|
|
|
|
|
|
Thnx. But I am a real fresher in .NET. The instructions that you have provided have gone way above my head . I wil be glad if you could explain it to me in some simpler terms.
With Best Regards,
Mayur
|
|
|
|
|
This can be done is the database's SQL code. Table triggers are commonly used to log information such as this.
Though, this technique is not supported in Access! Real SQL databases only!
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
mayhem_rules wrote: inssql = "Update PriceTable set Price = " & newprice & " where ID = '" & id1 & "' and Period = '" & Trim(period) & "'"
Please learn about SQL Injection Attacks and tips on how to prevent them[^] otherwise this code is going to get you 0wn3d!!!!111
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Sorry, did not get you. Neway, I m using MS Access. some usefull tips will be helpful.
With Best Regards,
Mayur
|
|
|
|
|
mayhem_rules wrote: Sorry, did not get you.
Your code is succeptable to a SQL Injection Attack. A mallicious attacker could gain control of your database through your web application if you don't defend it.
The article I linked to will explain what a SQL Injection Attack is and it will give some advice on how to defend yourself from it.
mayhem_rules wrote: Neway, I m using MS Access
Dismissive attitudes like this cause security problems. Regardless of the database platform you are using you need to at least understand what security threats exist in order for you to put together even a basic plan of defence.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
Anyone here knows how to trap the mouse cursor in the main form of a vb .net application? so that the user won't be able to use windows until it is unlock. can somebody help me with this?
|
|
|
|
|
You can track the mouse position with the Form's MouseMove event. Then handle the Form's MouseLeave event, and reset the mouse to the last known position recorded by the code in MouseMove through the Form's Cursor property.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-- modified at 7:51 Friday 20th January, 2006
|
|
|
|
|
Hello All
I want to manually enter items in the combox as:
cbo.Items.Add("Supplier")<br />
cbo.Items.Add("Customer")
How i can add ValueMember Field data manually? As we have an option in VB6 as:
cbo.AddItem ("Supplier")<br />
cbo.ItemData(cbo.NewIndex) = 1 'How this can be done in VB.Net?<br />
<br />
cbo.AddItem ("Customer")<br />
cbo.ItemData(cbo.NewIndex) = 2 'How this can be done in VB.Net?
''''''''''' I have done this way is there any solution better than this? ''
<br />
Dim lDT As New DataTable<br />
Dim col As DataColumn<br />
Dim row As DataRow<br />
<br />
col = New DataColumn<br />
col.ColumnName = "PartyClassType"<br />
lDT.Columns.Add(col)<br />
<br />
col = New DataColumn<br />
col.ColumnName = "PartyClassTypeID"<br />
lDT.Columns.Add(col)<br />
<br />
row = lDT.NewRow<br />
row(0) = "Supplier"<br />
row(1) = "S"<br />
lDT.Rows.Add(row)<br />
<br />
row = lDT.NewRow<br />
row(0) = "Customer"<br />
row(1) = "C"<br />
lDT.Rows.Add(row)<br />
With cbo<br />
.DisplayMember = "PartyClassType"<br />
.ValueMember = "PartyClassTypeID"<br />
.DataSource = lDT<br />
End With<br />
Regards
|
|
|
|
|
|
I was wondering, is there any differences between :
1.
<code>
Import System.Data.Oledb
Dim con as New OledbConnection()
</code>
and
<code>Dim con as new Oledb.OledbConnection() </code>
2.
Dim myString as string = "bla bla bla"</code>
and
<code>Dim myString as String
myString = "bla bla bla"
or it's simply personal preference?
WiL
|
|
|
|
|
1. No. They're exactly the same. In the second Dim statement, you just needlessly typed the extra namespace specifier (OleDb.) You don't have to because the namespace is specifically imported in the first line of code.
2. No. It's just a matter of preference. They're functionaly the same.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
when i define a new class/module so it is a new datatype..
i can define an object from it,, how i can save the object to a file on the hard disk and to retrieve it(load from file)???
|
|
|
|
|
I'm not sure what default serialisation code exists, but you probably need to write code to save the data in your class, and to reload it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
i need a sample code in vb.net to write/read a barcode?
|
|
|
|