Last post Aug 04, 2010 09:13 AM by karthicks
Aug 04, 2010 08:58 AM|DogTailRed2|LINK
I'm new to ASP.NET and finding the language frustrating when SELECTing data from a MYSQL database. I'm using ASP.NET, 5.2 .NET connector dll and VB 2008.
Is it possible, using the DB Form controls such as Gridview etc, to perform the following
SELECT room_descriptions FROM room_description WHERE current_room = 'some_value'?
The problems I'm encountering are;
1. Why does the query wizard add [ ] characters when they are invalid in VB.NET 2008 ? (I have to manually take them out for ANY query to work??)
2. How do I pass a value as some_value using the Query Wizard or some other easy to understand method?
I've tried adding a TextBox control and then specifying CONTROL in the WHERE part of the Wizard but I just get an error `? not defined' or some other not very helpful message when I run the code.
I'm getting frustrated because the Wizard seems to work but gives me queries that are invalid?? This doesn't make any sense. So I'm missing something obvious or trying to do something that is not possible? BTW the intended query works fine in Mysql.
I can quite successfully perform SELECT, INSERT, DELETE I just cannot get WHERE with a parameter to work. I want the user to be able to enter a number and pull that row from the table.
Aug 04, 2010 09:13 AM|karthicks|LINK
hi, refer below code
string connectionstring = "server=MyServer;database=MyDatabaseDB;" +
sqlparams = new SqlClient.SqlParameter("@inputone", SqlDbType.Int);
sqlparams.Value = Convert.ToInt32(ddlInputOne.SelectedItem.Value);
sqlparams = new SqlClient.SqlParameter("@inputtwo",SqlDbType.TinyInt);
sqlparams.Value = Convert.ToInt16(ddlInputtwo.SelectedItem.Value);
sqlparams = new SqlClient.SqlParameter("@inputthree",SqlDbType.SmallInt);
sqlparams.Value = Convert.ToInt16(ddlInputthree.SelectedItem.Value);