mysql query in asp.net
-
hi, i am new to asp.net but have some problem in asp.net coding i want to acess the mysql database data using asp.net coding. i write like this Dim cmd As OdbcCommand = New OdbcCommand("select * from nysemin where date='2009-09-14' and ticker_symbol='acc' ", con) the above code is like hardcoding manually.but i need dynamically i tried like this dim da="2009-09-15" Dim cmd As OdbcCommand = New OdbcCommand("select * from nse_und_5min where date="&da&" and ticker_symbol='acc' ", con) but error is showing how to complete the above requirement ie passing date value into dynamically in that query. have a nice day bye Naga
-
hi, i am new to asp.net but have some problem in asp.net coding i want to acess the mysql database data using asp.net coding. i write like this Dim cmd As OdbcCommand = New OdbcCommand("select * from nysemin where date='2009-09-14' and ticker_symbol='acc' ", con) the above code is like hardcoding manually.but i need dynamically i tried like this dim da="2009-09-15" Dim cmd As OdbcCommand = New OdbcCommand("select * from nse_und_5min where date="&da&" and ticker_symbol='acc' ", con) but error is showing how to complete the above requirement ie passing date value into dynamically in that query. have a nice day bye Naga
dim da="2009-09-15"
dim strQuery = string.Format("select * from nysemin where date='{0}' and ticker_symbol='acc'", da)
Dim cmd As OdbcCommand = New OdbcCommand(strQuery, con)Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
-
hi, i am new to asp.net but have some problem in asp.net coding i want to acess the mysql database data using asp.net coding. i write like this Dim cmd As OdbcCommand = New OdbcCommand("select * from nysemin where date='2009-09-14' and ticker_symbol='acc' ", con) the above code is like hardcoding manually.but i need dynamically i tried like this dim da="2009-09-15" Dim cmd As OdbcCommand = New OdbcCommand("select * from nse_und_5min where date="&da&" and ticker_symbol='acc' ", con) but error is showing how to complete the above requirement ie passing date value into dynamically in that query. have a nice day bye Naga
-
dim da="2009-09-15"
dim strQuery = string.Format("select * from nysemin where date='{0}' and ticker_symbol='acc'", da)
Dim cmd As OdbcCommand = New OdbcCommand(strQuery, con)Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
hi Manas Bhardwaj thanks for your reply. i will explain clearly i have one dropdown list in that list i have INDIA,USA,UK,UAE options are there when ever the user select particular option i need to pass that option into query and get the values from database. so i need dynamic value passing into that query.how to write for in ASP.net in java we write like Empno={33,44,55,55} String ss="Select * from emp where empno='"+Empno[i]+"' and salary="20000" "; but i am new toasp.net how it is possible. i tried like this but giveing error dim strQuery = string.Format("select * from nysemin where symbol='&Empno&' and ticker_symbol='acc'", da) have a nice day bye naag
-
Member 4640326 wrote:
"select * from nse_und_5min where date="&da&" and ticker_symbol='acc' ", con
Instead of tht use this
"select * from nysemin where date='" & da & "' and ticker_symbol='acc'"
If It Helps Click It as Answer
thanks sashidhar brother its working fine bye your younger brother naag
-
thanks sashidhar brother its working fine bye your younger brother naag