|
Hi Vuyiswa,
I will tell what the problem is, but I strongly advise you to take a look at this link: http://www.w3schools.com/sql/default.asp
On this website you will find a simple but free SQL tutorial. It will help you a great deal if you can see yourself what is wrong in this code, and it is invaluable if you want to develop yourself in coding.
Vuyiswamb wrote: 'Num_key' is not contained by this OleDbParameterCollection.
This is the actual problem. A little SQL 101: SQL queries a database. The query you just posted is a nice example of a simple query: SELECT certain columns FROM a table in the database. This query however will simply return everything it finds, and because we are only interested in certain data, we need to write a condition into the query. This is done by adding a so called WHERE clause at the end. In your case it would become:
SELECT ID, Lis_key, Erf_NO, Prop_Address, Own_Name, Site_Value, Num_key, Improvements_value, Improved_value FROM ValRoll WHERE Num_key = @NumKey the @ character tells the query that this is a so called parameter (a variable value). What you write after the @ character doesn't matter, it is just so that you know what value to enter there. So the first line of your code changes only slightly:
OleDbDataAdapter1.SelectCommand.Parameters("@NumKey").Value = txtnum_key.Text
In other words, the error was thrown because you tried to pass a parameter to a query that didn't contain one.
Please try this, and I strongly recommend typing in sql tutorial in Google.
Johan
My advice is free, and you may get what you paid for.
|
|
|
|
|
Thannk you man, my mistake, i saw the Mistake and Fixed it, that is why i modified the thread. i know SQL just i was Clumsy. sorry about that. thank you Johan
Vuyiswa
|
|
|
|
|
Hi
I have a windows application I developed using visual studio 2005 that looks very good on XP operating system. I have just got a vista laptop and now ran the exe on the laptop and it looks very different. All washed out. Can I make a change to my application to keep the XP look on vista? Thanks in advance
|
|
|
|
|
That depends on if Vista still has the older control libraries in it. i have no idea if it does or doesn't. I don't use Vista at the moment.
If it does, then it should just be a matter of creating/changing your applications manifest file. Read this[^].
|
|
|
|
|
Hi.
Where the ConnectionString In crystal Report has saved?
It isn't in app.config.
Suppose I have Report, My SQL Server Instance name is 'Mehrdad',
I want to run this report in another machine that SQL Server Instance name is 'John'.
Now it doesn't work properly and an error occured (because of ConnectionString)
I have changed the ConnectionString in app.config, but there was no affect.
Best wishes
|
|
|
|
|
Have you looked in the Designer Generated code section of your form?
|
|
|
|
|
Well here I am again, heres what Im trying to to. I have a Folder Ive created in a specified path withint the application, there will be more than one file in said directory so heres what I need to do:
This folder is used to hold the ErrLog.txt file I created in the application to log errors that have happened, I am now wanting to limit the size of this file to 10MB, so I need to be able to retrieve the current file being used (whether it be ErrLog1.txt, ErrLog2.txt, and so on) then check the size of this file and if its too big then close it, open a new file (with the next number appended to it) and use that file until it reaches the size limit, and so on.
Ive done some searches on Google (as well as some other forums Im a member of) and havent found anything real useful, so I always return to the one place I can find answers, CP. Anyone got some ideas/links/samples I can look at and use to accomplish this?
"Let's face it, the average computer user has the brain of a Spider Monkey."
Bill Gates
|
|
|
|
|
This is easy if you think about it.
You don't need the log file open all the time. You open it, write your message, close it. Simple. Now, all you have to do is check the size of the file BEFORE your open the log and write to it. The FileInfo class comes in handy for that. If the size of the current logfile is greater than 10MB, increment the filename and use the new name for the log file.
|
|
|
|
|
Well I've gotten that far but am having a few issues: Figuring out what is the file currently being used (as theoretically there could be multiple files after years of use), how to determine the number at the end of the file). I already have coded to determine the size of the file. I may be over-complicating this, sometimes I do that, but I seem to have hit a wall on this.
"Well yes, it is an Integer, but it's a metrosexual Integer. For all we know, under all that hair gel it could be a Boolean."
Tom Welch
|
|
|
|
|
Psycho-*Coder*-Extreme wrote: Figuring out what is the file currently being used
When you change the filename, you save it to either an XML config file you design, or your app.config file, or a spot in the registry.
|
|
|
|
|
I came up with this solution:
Private Shared Function NeedNewFile(ByVal fileName As String) As Boolean
Dim filePath As String = sPathToUse & "\Errors\" & fileName
If File.Exists(filePath) Then
Dim fInfo As New FileInfo(filePath)
Dim fileSize As Long = fInfo.Length
With fInfo
If .Length >= (MAX_ERRORLOG_SIZE * 1024 * 1024) Then
File.Copy(filePath, filePath & "_Archive_" & Now.Day & Now.Month.ToString("MMM") & Now.Year & ".txt")
Dim sWriter As New StreamWriter(filePath, False)
sWriter.WriteLine("--New Log Created --
sWriter.Close()
Return True
Else
Return False
End If
End With
End If
End Function
Ad this seems to do what I need it to do (so far), now I need to do some more testing, make the target path larger than 10MB and see what happens.
"Okay, I give up: which is NOT a real programming language????"
Michael Bergman
|
|
|
|
|
Psycho-*Coder*-Extreme wrote: there could be multiple files after years of use
Why are you anticipating this many errors during the lifetime of the app?
I have absolutely no idea about what the requirements of your project are but that doesn't sound quite right to me.
|
|
|
|
|
Dave,
I'm really not anticipating that many errors from the parts that I'm responsible for, but I work with a relatively new and young programmer who has a hard time (it seems) to do adequate exception handling. Realistically there may never be more than a couple error logs over the lifespan of the application, but I have a hard time allowing myself to assume something wont happen, I have to code for exceptions to the rules as well because you never know what the users going to do, thats just the way I am.
"Okay, I give up: which is NOT a real programming language????"
Michael Bergman
|
|
|
|
|
Psycho-*Coder*-Extreme wrote: who has a hard time (it seems) to do adequate exception handling
Slap him. Slap him silly.
|
|
|
|
|
Dave Sexton wrote: Slap him. Slap him silly.
I have thought about this, but I know it will cost me my job (if I knew I could get away with it I would probably do it :->. Once, he actually "bitched" at me for putting code in a Try....Catch block, saying that an error couldn't possibly happen in that function and that I needed to remove it, to which I replied "Assumptions are the mother of all f**k ups".
He has a bad habit of assuming something cant happen, or that the user cant possibly do something to raise an error. No matter how hard I've tried to explain this he just wont listen, but hey in the past 4 months he's had over 20 "trouble tickets" for the processes he's coded, and I've had 2. Maybe someday he'll grow out of his arrogance and start seeing things in the right light
"Okay, I give up: which is NOT a real programming language????"
Michael Bergman
|
|
|
|
|
Psycho-*Coder*-Extreme wrote: "Assumptions are the mother of all f**k ups"
I remember a guy on a development team I was part of yelling that at one of the sales guys who demanded a feature that we later discovered no one wanted. The sales guy just assumed that a potential customer wanted a certain feature. He didn't. And he didn't buy either.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton
My website
|
|
|
|
|
Psycho-*Coder*-Extreme wrote: but hey in the past 4 months he's had over 20 "trouble tickets" for the processes he's coded, and I've had 2.
Is he assuming he won't get fired for his "quality" code? That's the mother of all f-ups.
|
|
|
|
|
Dave Kreskowiak wrote: Is he assuming he won't get fired for his "quality" code?
Dave,
Thats exactly what he's assuming. He's been there coming up on 4 years, and we were both made part of the IT department about 4 months ago, we were just the personal programmers for one department, we didn't have to follow any of the SOCKS(sp?) Compliance issues, none of the Software Development Life Cycle or anything, if they wanted something we made it then gave it to them, so up until now no one ever knew of any "bugs" he wrote. I'm hoping that now that they're coming to light something will be done about it.
"Okay, I give up: which is NOT a real programming language????"
Michael Bergman
|
|
|
|
|
hi
How can i get the content of selected row on the double click event of datagridview in vb.net2005 to dislpay in textbox?
Pls. reply immediate
thanks
bye
|
|
|
|
|
Don't Cross Post.
Regards,
Satips.
|
|
|
|
|
<b>Suppose I have numeric values in my listbox. How do I add(addition) them and display the result in textbox. Plz help me guyz. I need the code both in VB.NET as well in C#.NET. plz plz help me out.</b>
Mash
|
|
|
|
|
Dim i as Integer
dim Total as Decimal = 0
For i = 0 to lstTest.Items.Count - 1
Total += Ctype(lstTest.GetItemText(lstTest.Items(i)),Decimal)
Next
txtTest.Text = CStr(Total)
Converting it to C# is very simpel
Best Regards
3ala2
|
|
|
|
|
vb.net
dim i as Decimal
dim c as integer
for c = 0 to c = listbox1.count
i += listbox1.items.item(c)
next c
textbox1.text = i
c#
dec i;
int c;
for (c = 0; (c <= listbox1.count); c++) {
i = (i + listbox1.items.item[c]);
}
textbox1.text = i;
Did c# with an online translator so it might not be %100 correct.
Posted by The ANZAC : "WWBD, What Would Buffy Do?" : "I don't know man, she's stronger than me"
|
|
|
|
|
The ANZAC wrote: Did c# with an online translator so it might not be %100 correct.
C# look sgood to me!
|
|
|
|
|
Can Somebody Give example of Trim Method
If provide with small example prog will be a great help
Nitin Jenwal
|
|
|
|