.net + dynamic SQL-query
On our page we have texbox, dropdownlist, database and gridview for it.It DropDownList we have all names of columns from database (in our situation they are Item_Name, Item_Type, City and Country). In database we have two more columns, but we do not need them in this task.And the task is to choose from DropDownList item/value and deliver it to SQL-query. We have done searching from database, but the column to search from is static, we want to make it dynamic, we want to choose from Dropdownlist column, from which we will search.We are making all in aspx, not in .cs code. We are not fam...assign SQL to datasource dynamically
Hello,I have a default SQL statement assigned to the datasource: select * from customers. But when I want to dynamically change this at runtime, e.g.: accessdatasource.selectcommand="select * from categories where custCity="& lblCity.Text (lblcity is in this case NY of which there are plenty fields in my DB) it appears that after the postback this command is lost, the gridview linked to the datasource disappears from the screen....This is my problem and this is what I heard before as an answer:"You only specify the SelectCommand when the button is pressed. When you don't press...Converting a gridView using an Sql Datasource to a gridview who is not using an SQL DataSource
How can i rewrite this page so that i doesnt make use of an SqlDataSource?
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="LoginHistory.ascx.cs" Inherits="Private_UserControls_WebUserControl" %>
<%--<link rel="stylesheet" href="BaldwinPortal.css" mce_href="BaldwinPortal.css" type="text/css" />--%>
<body style="margin:0 0 0 0;padding:0 0 0 0">
....Net connect process to SQL 2000 sp4
Hello - hopefully an easy one for someone who knows what they are doing... i have read a number of tutorials, but am completely new to .net.
I am trying to start simple, I would just like to write a code which reads a record from a table, saves the value as a variable, then simply displays the variable on the screen.
My server is the local server, has a trusted connection, the SQL database is called UserDB. The table is called Users. The column I'd like to read is UserID (contains numeric values, 6 digits)
I have included the code below, and the error I receive...SQL Injection and Dynamic SQL
The consensus on avoiding SQL injection attacks is to pass all your collected data to a stored procedure. If you have to return a result set from a complex form, the answer seems to be to use dynamic SQL. On further study, I discovered that dynamic SQL has a lot of potential pitfalls and low and behold can still be vulnerable to injection attacks. I know that I am not the first person to ever try and collect data from a web form and return a result set, so what are the best practices? Say I have a complex form with about 25 search criteria (most of which are optional), I go through all t...Dynamic SQL in Sybase SQL
Im trying to create a bit of Dynamic SQL in a Sybase stored procedure, im
used to MS SQL Server so im not sure what im doing wrong in Sybase.
Heres my bit of code
declare @sql varchar(100)
declare @sql2 varchar(100)
Select @sql =
select @sql2 = 'select * from table where table_tra_code in (' + @sql + ')'
now i would have thought this would have executed @sql2 and returned a
result set, but no :(. Any ideas?, id...Dynamic SQL in Transact SQL
Does Dynamic SQL can be done in transact sql format in stored procedure?
any reference can be read?
...gridview, access datasource, dynamic assignment sql statement
I have a gridview "gvTable" and a datasource "accessdatasource1".When I load the page all the data from the table "Models" is displayed.When I click the Categories button I want to have the gridview display the rows from my "Categories" table (which contains columns: ID and CategoryName), on pages of each 5 rows in length.It does display all the info in the right amount of rows.HOWEVER: when I click on the next page or column header to sort I get the error:"System.IndexOutOfRangeException: Cannot find column CategoryName"Here's all my code:
<asp:GridView ID="gvTable" runat="server" Allow...SQL Server Reporting Services for SQL SERVER 2000 AND Visual Studio.NET 2005 .NET 2.0
Hi, Which version of SQl Server Reporting Services will work with SQL SERVER 2000 in pararrel with ASP.NET 2.0 (.NET 2.0 framework)? Thanks, Azam HighOnCodingWanna get high!
Hi, Okay I got the answer. Yes, we can use the SQL SERVER 2005 Reporting Services with SQL SERVER 2000. HighOnCodingWanna get high! ...passing url param to a sql report viewer in .net page
I have report viewer on an asp.net 2.0 page with a Sql report from sql 2005 embedded in the report viewer. I
thought I could just put report parameter in the query string and it
would just pass the parameter to the report but that did not work. For instance I have a report the has a parameter- IDI thought I could just create a link to the report like myreport.aspx?ID=1234That did not pass the parameter to the report. How can I do that?I don't have any real code just the asp to embed the report <%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=184.108.40.206, Culture...SqlDataSource configueration depending on URL params and dynamic SQL query
how to configure SqlDataSource to use WHEN conditions only when required URL param is presented? (not using default param value)
then to use SELECT * FROM blooh WHERE paramA='blah'
otherwise if no params present - use SELECT * FROM myTable
i.e. i want to display ALL records from the table
or variant B:
then to use SELECT * FROM blooh WHERE paramA LIKE 'blah'
otherwise if no params present - use SELECT * FROM index
is it possible?
This is not a question but I had to share something I was finally able to figure out and thought it may be helpful to others as well. With the help from Ryan Olshan's website I was able to take what he had and make it work for my needs. The difficulty I had was that I need to dynamically build my SQL statement based on the users selections from the main page. Also because it's Oracle and I don't have access to create stored procedures. Hope this helpful and I signed up because I felt the need to give back to those who helped me via countless Google searches. Note, ...How to Update when dynamic Select SQL by using SQLDatasouce In .net 2.0?
In Dot net 2.0 we change using SQLDataSource to Conect with SQLDB.
Now for My case ,the Select SQL is dynamic when differnece user and parameters to the page, So if I want to Update the data input by user,then I must give Update/insert/delelte SQL to SQLDatasource's InsertCommand /UpdateCommand/DeleteCommand .
How to Generate the Insert/update/delete command for the SQLDataSource ? as in dot net 1.1 can use SQLCommandBuilder to generate it,but SQLCommandBuilder just support DataAdeptor not for SQLDataSource, Could any body know how to do it when the SelectCommand is dynamic an...How to play media file from dynamic sql url, possible paid work
Hi, I'm new so please excuse my noobish question. I did a search and not coming up with anything so any help would be great. I'm trying to play some asx files from a streaming media server that plays off a webpage with wmp embedded by using ashx or dynamic url from sql. I've seen some sites like yahoo, aol, use dyanmic urls such as somesite.com/asx?=1 that plays in wmp ... After looking at the tutorials and searches I'm still at odds on how to do that. How do you play the querystring to the file in a embedded wmp. I can make the querystring bu...