|
i have a table which i call "RATES" and it s
..............(column1)
..............rate_start....commission.....rate_finish
row 1
................300..............2.............500.....
................501..............3.............600.....
................601..............4.............700 ....
.......................................................
................1500 ............8.............1800....
user entry etc total.text="532" (if user entry is "532" then respond should be "3")
how can i find the correct "commission"
my query is not working right it s ;
"select commission from RATES where rate_start < "' total.text and rate_finish > VALUE ....
plz help me
|
|
|
|
|
plz let me know your own query do not try to fix my query
|
|
|
|
|
I assume this is homework. You should talk to your teacher if you are stuck, or read the books your class recommended.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
... WHERE rate_start <= " & total.text & " AND " & total.text & " <= rate_finish"
How hard can it be?
warnings:
1. you need <=
2. what if the user enters a bad number, e.g. -5?
3. what if the user enters a partial SQL command that would delete your tables?
Recommendations:
4. use PRE tags for a non-proportional font, as I did above.
5. extract, parse and validate your user input; do not directly enter user text into an SQL statement.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
I have this string "Name1 Name2 Name3" and want to split that a=Name1, b=Name2 and c=Name3. How to make this
|
|
|
|
|
congratulations. your subject line is very good. even Google understands it.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Given the existence of intellisense, how can someone even intuitively know the command they need, and still not find it ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Christian Graus wrote: how can someone ... not find it ?
That is a though one.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Dim x() as String
Dim str as String = "Name1 Name2 Name3"
x = str.Split(" ")
'Now x(0) will be Name1, x(1) will be Name2, etc.
|
|
|
|
|
|
Do some experimentations before asking for help. You store it in a "string" and you want to "split" it. Your question contains the clue in itself. Use the String.Split() method. .NET has made it very easy and intuitive to learn and to do programming. Yet, people keep asking such basic questions.
|
|
|
|
|
Hi,
I want to delete my sql database entries, i.e. delete all the rows of database "payments".
I have written this code:
Public Function DeletePayRecord()
cmd = New SqlCommand("Select * FROM payments", con)
If con.State = ConnectionState.Closed Then con.Open()
myDA = New SqlDataAdapter(cmd)
Dim myPayDeleteDataSet As New DataSet()
myDA.Fill(myPayDeleteDataSet, "payments")
For Each dr As DataRow In myPayDeleteDataSet.Tables("payments").Rows
dr.Delete()
Next
End Function
I found that my rows are not getting deleted. Please suggest me how to do this?
Thanks.
|
|
|
|
|
You're kind of taking the long way with what you have so far. You can use what you have and just add that you need to do an update back to the database...or you can start over and use a Delete SQL statement.
If you use the Delete SQL statment
DELETE * FROM payments
You don't even need a data adapter. Just run the command with an execute nonquery.
|
|
|
|
|
Please send me the code for VB. I want to delete all the rows of column "Date of Joining" when this column is > 1/1/2009.
I tried with this:
cmd = New SqlCommand("Delete * FROM payments WHERE [Date of Joining]> '" & 1 / 1 / 2008 & "'", con)
cmd.ExeceuteNonQuery()
Its is not working. Kindly suggest some code on this.
thanks
|
|
|
|
|
Well, what error are you getting or what is it doing?
|
|
|
|
|
I am not able to delete the database.
|
|
|
|
|
no need for & and too many double quotes!
and 2008 <> 2009
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Even better Truncate Table Payments .
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
Are the triple bangs in your subject line significant?
|
|
|
|
|
yes. it is a subtle way to indicate urgency without vexing anyone...
and it worked well.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Luc Pattyn wrote: yes. it is a subtle way to indicate urgency
That's the problem. It is just too subtle. Chris ought to allow these folks to type the subject line in a rainbow of colors, or maybe use the blink style. Or both! (!!!)
Luc Pattyn wrote: without vexing anyone
That's important. I have heard that there are some old codgers here on CP who consider noobs an acceptable substitute for cold pizza and stale coke.
|
|
|
|
|
whatever we try, I guess there will always be some cold pizza and stale coke. That's the price we pay for helping out around here...
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Luc Pattyn wrote: I guess there will always be some cold pizza and stale coke.
2 of the 4 food groups that helped me make more'n one roll-out.
I spent a little time tonight hitting you with some 5's. Your answers are bang-on and obviously an attempt to teach them how to fish for themselves (which is probably why you don't get enough thanks.)
|
|
|
|
|
I'm not really fishing for thanks; when I sense some interest, I try to stimulate it.
When some one doesn't like it, so be it.
Cheers.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Luc Pattyn wrote: I'm not really fishing for thanks
All the more reason for folks to be grateful to you, IMHO.
|
|
|
|