1
Answer

SQL CURSORS - in ASP

axnst1

axnst1

20y
1.6k
1
This is basicly what I am tying to accomplish in an ASP.NET app: ----------------------------------------------- DECLARE cur_temp SCROLL CURSOR FOR SELECT Connection FROM Popouts OPEN cur_temp DECLARE @popout_no FETCH FIRST FROM cur_temp ------------------------------------------------- The SQL 2000 Query Analyzer runs it without errors. Questions: ------------ - How do I make my SQL query string be equal to that? (Since it's more then one command/line) - Is there a better way to go through a SQL DBase, inspect the contents of a column and populate another column depending on contents of the first column? And do that for every record one-by-one? This is How I tried and it didn't work: ------------------------------------------ strSQLQuery = "DECLARE cur_temp SCROLL CURSOR; FOR SELECT Connection FROM Popouts;OPEN cur_temp;DECLARE @popout_no;FETCH FIRST FROM cur_temp;" objCommand = New SqlCommand(strSQLQuery, objConnection) objConnection.Open() DBUpdateDataGrid.DataSource = objCommand.ExecuteReaderCommandBehavior.CloseConnection) DBUpdateDataGrid.DataBind() objConnection.Close() -------------------------------------------- This is the error message I get: ------------------------------------- System.Data.SqlClient.SqlException: Line 1: Incorrect syntax near ';'. -Thanks
Answers (1)