Executing Sql Scripts From Aspx....plz Help!
Apr 14, 2004Hi All,
How to execute the sql scripts (which may be in .sql file or a string) from code behind files?
Thanx
Veeru.
Hi All,
How to execute the sql scripts (which may be in .sql file or a string) from code behind files?
Thanx
Veeru.
Hi,I have a form page with an insert like this:<asp:SqlDataSource ID="addProductDataSource" runat="server" InsertCommand="INSERT INTO test( title1, firstName1, lastName1, dateOfBirth ) VALUES ( @title1, @firstName1, @lastName1 @dateOfBirth )" ConnectionString="<%$ ConnectionStrings:yourQuoteCentreConnectionString %>"> <InsertParameters> <asp:ControlParameter ControlID="dateOfBirth" Name="dateOfBirth" Type="DateTime" /> <asp:ControlParameter ControlID="title1" Name="title1" PropertyName="Text" /> <asp:ControlParameter ControlID="firstName1" Name="firstName1" PropertyName="Text" /> <asp:ControlParameter ControlID="lastName1" Name="lastName1" PropertyName="Text" /> </InsertParameters></asp:SqlDataSource> In default.aspx.vb I have:Protected Sub Wizard1_FinishButtonClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizard1.FinishButtonClick 'CREATE DATETIME FROM USERS BIRTH DATE Dim dateOfBirth As New System.DateTime(applicantYear.SelectedValue, applicantMonth.SelectedValue, applicantMonth.SelectedValue, 0, 0, 0) 'INSERT TO DATABASE addProductDataSource.Insert()End SubI would like to reference the variable dateOfBirth created in default.aspx.vb in the insert query on the page, or ideally move the insert query into the aspx.vb page. Would this make more sense to do?Thanks,Paul
View 6 Replies View Related
Hi,
I have a web application using Stored Procedure (SP). I see that there's a SP taking long time to execute. I try to capture it by Profiler Tool, and find out that with the same SP on the same db with the same parameter. The duration of executing by my web app is far bigger than the duration of executing on SQl server management studio - query window
Please see the image through this url http://kyxao.net/127/ExecutionProblem.png
Any ideas for this issue?
Thanks a lot
Hi,I have a web application using Stored Procedure (SP). I see that there's a SP taking long time to execute. I try to capture it by Profiler Tool, and find out that with the same SP on the same db with the same parameter. The duration of executing by my web app is far bigger than the duration of executing on SQl server management studio - query windowPlease see the image attached http://kyxao.net/127/ExecutionProblem.png Any ideas for this issue?Thanks a lot Jalijack
View 2 Replies View RelatedHi all,I am facing an unusual issue here. I have a stored procedure, that return different set of result when I execute it from .NET component compare to when I execute it from SQL Management Studio. But as soon as I recompile the stored procedure, both will return the same results.This started to really annoying me, any thoughts or solution? Thanks very much guys
View 2 Replies View RelatedI'm trying to use a Select statement on Full-Text-Indexed field in SQL Server.The .aspx page does not like the " " inside my SQL statement. How do I get around this?Select parts.ProductNumber, T1.Description FROM T1, T2
WHERE T2.Ground='1' and T1.ProductNumber=T2.System and CONTAINS(T1.Description, '
"5001*" ')It does not like the " around the 5001* how do I escape them or whatever to make it work?- Rex
Hi!Im building a site for internal use for a company i work at.And im having hard to decide what to do. The alternatives arecomma separated lists vs separate tables. For example.. I will use a number of different type of objekt that all will hold 1 or more document links, phone numbers, emails etcAs far as i can i i have 2 possibilitys. One is to add textfields for each of these subojects in each objects tables. Then i add all info as commaseparrated lists in 2-3 layers wich i then save in the respecive objects fields. (Look like something below for example ),comment'emailadress,comment'emailadress,Or i add 1 table for each subobject type wich manage the subobjects or link between different objectsfor example:table layout for email:id | parent_type | parent_id | comment | emailOr for example contacts a mediator table:id | parent_type | parent_id | contact_id Hope you understand what i mean, would really appriechiate suggestions, comments regarding what can be considered as "best practise" in these cases. Putting it in separate tables should make searches easier, and coding easier in my book. But again im thinking if perhaps commalists is a faster and more recource conservative way of doing it + to me it feels like (perhaps i have no reason to think this?) making tables for items like feels like a timebomb if you exhaust your idfields identity count. Though this app will be used by perhaps 100ppl at most so perhaps not an extremely utilized webapp.Anyway glad if you could give me some input!
View 4 Replies View RelatedI am trying to deploy an aspx application which talks to sql 2005. The application files are on a w2003 web server with asp.net 2.0 and the sql server is a 2003 server with sp1. when i attempt to browse this application i am prompted with "Unable to get records. Unable to connect to database. Login failed for user 'NT Authorityanonymous Logon'". The application is set to use windows authentication. However if i create the "anonymous" login in sql and make it a sysadmin, it works, of course. In my dev enviroment i have sql2005 and iis on same w2003 server and the same application WILL run and there is NO anonymous account, just using AD accounts.
View 2 Replies View RelatedHello,
I am using the web blog at http://weblogs.asp.net/scottgu/archive/2007/01/11/tip-trick-how-to-upload-a-sql-file-to-a-hoster-and-execute-it-to-deploy-a-sql-database.aspx
to deploy an SQL script on my database. The sql script is named aspnetdb.sql and is placed in my main directory.
Now using the file RunSQL.aspx which is also placed in the main directory (www.genealogy-prototype.com/RunSQL.aspx) I have changed the parts in the file which need changing:// Url of the T-SQL file you want to run
string fileUrl = "http://genealogy-prototype.com/aspnetdb.SQL";
// Connection string to the server you want to execute against
string connectionString = @"Server=genealogy-prototype.com;User ID=marko;Password=
123;Initial Catalog=aspnetdb";but when I go to my page genealogy-prototype.com/RunSQL.aspx I am getting an error. However I'm not sure what this error is as it says I need to change custom errors to off in web.config, i have done this but it still says i have it on...
I'm guessing it must be something to do with the connection string i have given or the file url. My hosting company is freezone.co.uk, my ms sql database name is aspnetdb my username for this database it marko and there is no password. Is the connection string i have given wrong?
I have been trying this for over a week, any help would be great!!Thank you, Mark
Hello,
I have a stored procedure that is used to create a DataDictionary for the database. Basically, the sproc generates HTML and you can then run it from Query Analyzer by Saving to a file.
What I want to do is to run this from an aspx page.
The sproc uses PRINT to create the text.
Like this.
PRINT '<html>'
PRINT '<head>'
PRINT ' <title>SQL Server Data Dictionary Report - ' + @strDatabase + ' </title>'
PRINT '</head>'
PRINT '<body bgcolor="#FFFFFF" text="#000000" link="#008000" vlink="#008000">'
PRINT '<a name="Top"></a>'
PRINT '<div align="left">'
Is it possible to get the text that is generated from this sproc?
What do I need to do to get the text that has been created and display it on a page?
Thanks a lot.
Hello,
Can someone kindly point out what is wrong with the following code file. I'm trying to:
- fill a dropdown from a db on page load (this works!)
- when user selects from the list and hits a button, pass the dropdown value to a second query
- use the second query to make another call to the db and fill a data grid
In the code below, if I swap an actual value (eg '1005') into the command and comment out the .Parameter.Add statements, the dategrid is filled sucessfully. Otherwise, when the button is pressed, nothing is displayed.
Thanks
PS comments about my coding approach are welcome - I'm new to aspx...
<%@ Language="VBScript" Debug="true"%>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.data.SqlClient" %>
<html>
<head>
<script language="vb" runat="server">
Dim dbConnection As SqlConnection
Dim ds_Teams,ds_Agents As DataSet
Dim sqlCmd_Teams,sqlCmd_Agents As SqlDataAdapter
Dim dbConn = "server=csacd01;uid=mpierce;pwd=cabledog;database=clearviewacd"
Dim sql_select_teams = "" & _
"SELECT team_no, team_name " & _
"FROM dbo.team " & _
"WHERE (team_status = 'Curr')"
Dim sql_select_agents = "" & _
"SELECT last_name + ', ' + first_name AS name, agent_no " & _
"FROM dbo.users " & _
"WHERE (team_no = @Team) AND (NOT (agent_no = '1029')) " & _
" AND (NOT (last_name IS NULL)) " & _
" AND (NOT (first_name IS NULL)) " & _
" AND (NOT (first_name = 'FirstName')) " & _
"ORDER BY last_name"
Dim teamList = "teamList"
Dim agentList = "agentList"
Sub Page_Load(Sender As Object, E As EventArgs)
if not (IsPostBack)
ds_Teams = new DataSet()
dbConnection = New SqlConnection(dbConn)
sqlCmd_Teams = New SqlDataAdapter(sql_select_teams, dbConnection)
sqlCmd_Teams.Fill(ds_Teams, teamList)
dbConnection.close()
dropdownlist_Teams.DataSource=ds_Teams.Tables(teamList).DefaultView
dropdownlist_Teams.DataBind()
end if
End Sub
sub Get_Agents(Sender As Object, E As EventArgs)
ds_Agents = new DataSet()
dbConnection = New SqlConnection(dbConn)
sqlCmd_Agents = new SqlDataAdapter(sql_select_agents, dbConnection)
sqlCmd_Agents.SelectCommand.Parameters.Add(new SqlParameter("@Team", SqlDbType.NVarChar,4))
sqlCmd_Agents.SelectCommand.Parameters("@Team").Value = dropdownlist_Teams.DataValueField
sqlCmd_Agents.Fill(ds_Agents,agentList)
dbConnection.close()
datagrid_Agents.DataSource=ds_Agents.Tables(agentList).DefaultView
datagrid_Agents.DataBind()
end sub
</script>
</head>
<body>
<form runat="server">
<asp:DropDownList id="dropdownlist_Teams" runat="server"
DataTextField="team_name"
DataValueField="team_no">
</asp:DropDownList>
<input type="submit" onserverclick="Get_Agents" value="Get Agents" runat="server"><br />
<ASP:DataGrid id="datagrid_Agents" runat="server"
Width="500"
BackColor="#ccccff"
BorderColor="black"
ShowFooter="false"
CellPadding=3
CellSpacing="0"
Font-Name="Verdana"
Font-Size="8pt"
HeaderStyle-BackColor="#aaaadd"
EnableViewState="false"
/>
</form>
</body>
</html>
Hi! i'm dani, from spain. I´m looking for sombody to help me.
The trouble is as i have indicated. I get the next error when my page aspx needs to acced to the SQL Bd:
"Error of beginning of session of the user '(null)'. Reason: it is not associate to a connection of confidence SQL Server."
I hope a reply.
Thanks and greethings.
Hi All,I am trying to run aspx website on IIS version 6. It works locally with WEb Matrix but when I put the site into the IIS server, it cannot connect to the database. THe IIS is sonfigured and all users have full permissions but the error that is returned is:Login failed for user '(null)'. Reason: Not associated with a treusted SQL Server connection.SQL Server 2000 is installed and a connection is open to the database in question. Would be very greatfull for ANY help on this, being tryin to get this workin for days!!Collette.
View 3 Replies View RelatedHi, i am trying to retrive some datetime set from the database (2 posts in this table), senastposted is a datetime field.when i run:SELECT senastposted FROM ftp WHERE senastposted <= 2005-10-28i get this result:
senastposted
0 record(s) affected.and when i run: SELECT senastposted FROM ftp WHERE senastposted >= 2005-10-28i get this result:
senastposted
25-10-2005
29-10-2005
2 record(s) affected.what i want is to retrive the first value based on the date:25-10-2005any idea why SELECT senastposted FROM ftp WHERE senastposted <= 2005-10-28 dosent work?( i have tried to change the dates to 28-10-2005 and 28/10-2005)
Hello,
I am using the web blog at http://weblogs.asp.net/scottgu/archive/2007/01/11/tip-trick-how-to-upload-a-sql-file-to-a-hoster-and-execute-it-to-deploy-a-sql-database.aspx
to deploy an SQL script on my database. The sql script is named aspnetdb.sql and is placed in my main directory.
Now using the file RunSQL.aspx which is also placed in the main directory (www.genealogy-prototype.com/RunSQL.aspx) I have changed the parts in the file which need changing:
// Url of the T-SQL file you want to run
string fileUrl = "http://genealogy-prototype.com/aspnetdb.SQL";
// Connection string to the server you want to execute against
string connectionString = @"Server=genealogy-prototype.com;User ID=marko;Password=</span>
<span lang=EN>123;Initial Catalog=aspnetdb";
but when I go to my page genealogy-prototype.com/RunSQL.aspx I am getting an error. However I'm not sure what this error is as it says I need to change custom errors to off in web.config, i have done this but it still says i have it on...
I'm guessing it must be something to do with the connection string i have given or the file url. My hosting company is freezone.co.uk, my database name is aspnetdb my username for this database it marko and there is no password. Is the connection string i have given wrong?
I have been trying this for over a week, any help would be great!!
Thank you, Mark
Hi can someone help me?
I'm using Access database and Microsoft VS2005 (VB)
I need to take data from 2 different tables in 1 database. But i can't seems to get it right!
I have: - dbWarehouse.mdb- tblReadDetails and tblStock
I need to use "Barcode" from tblReadDetails, compare it with "Barcode" in tblStock then retrieve all the column in tblStock and put it in a webpage.aspx list box.
I tried the following code...cn.ConnectionString = strConncn.Open()cmd = New OleDbCommand("SELECT tblStock.Barcode, tblStock.Item, tblStock.Dept, tblReadDetails.Barcode FROM tblStock JOIN tblReadDetils WHERE tblReadDetails.Barcode = tblStock.Barcode", cn)dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)While dr.Read()lstBarcode.Items.Add(dr2.Item("tblStock.Barcode"))lstItem.Items.Add(dr2.Item("tblStock.Item"))lstDept.Items.Add(dr2.Item("tblStock.Dept"))End While
but it prompt me the following error...
OleDbException was unhandled by user codeSyntax error in FROM clause
What's wrong with this code?
Regards and thanks!
Hi,
I have the problem in accessing data from MS-SQL server by using Dreamwearver MX 's VB.NET page. Although it works well, in the date format, it also display time. Please see the following code.
SELECT student_ID, Material_ID, Borrow_Date, Due_Date, Renew_Date, Status, include_withFROM dbo.RecordWHERE student_ID = @student_ID
To remove time, I added the following code as follows. After that, I can preview and works well without having time.
SELECT student_ID, Material_ID, convert(varchar(10),Borrow_Date,103), convert(varchar(10),Due_Date,103), convert(varchar(10),Renew_Date,103), Status, include_withFROM dbo.RecordWHERE student_ID = @student_ID
But, when I browse, I get the runtime error. When I look more details in server, the error said " Parser Error Message: The server tag is not well formed." and error in <MM:DataSet"
Please help me.
Jon
Hello All,
I am just getting started on aspx, coming from an asp background.
I created the following connectionString in my web.config file:<connectionStrings>
<add name="OuWebDB"
connectionString="server=OurServer;database=OurDatabase;uid=TheUser;pwd=ThePassword"providerName="System.Data.SqlClient"
/>
</connectionStrings>
when I run this aspx file, from a machine, I get the following error:
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Help!!
thanks
Hi all,
I am excuting DTS package from code behind and the table is created in the SQL database. However, the data in my excel sheet is not transferred over and Im not sure where the problem lies. Below is my code:
pkgLocation = @"C:/Program Files/test.dtsx";
app = new Application();
pkg = app.LoadPackage(pkgLocation,null);
pkgResults = pkg.Execute(); Any advice is much appreciated.
Hi,
like subject, is it possible?
bye
hi , I would appreicate your help, I have created a store procedure in MS sql server 2000 to be called from aspx page.
The store procedure will have multiple functions:
checking if a file exist in c:data
if file exist, it will use zip file command line to unzip the file and then run DTS package to upload the database.
The issue I am having is when I run the store procedure from MS query analyzer,I get a confirmation that the whole procedure ran successfully, but when I call the same procedure from aspx, althought the store procedure ran successfully, but I did not get any confirmation to the user in the aspx page to notify the user that the process successed.... here is my code in where I think is not working,
CREATE PROCEDURE p_on_demand_dts_sales_option_price_report_3_ftest
@id int , @msg_output varchar(28) output
as
declare @varcmd varchar(255),@FileExist int
select @varcmd = null
select @varcmd ='dir :Data_on_demandsales_option_price_report.csv' -- check if file exist
EXEC @FileExist = master..xp_cmdshell @varcmd
set @msg_output = 'The file exists'
Return 44
+++ The above store procedure use command line to check if the csv file exist, its suppose will return a output parameter and a return # BUT it did not. To my surprise, when I modify the above store procedure like this, it work
-----
CREATE PROCEDURE p_on_demand_dts_sales_option_price_report_3_ftest
@id int , @msg_output varchar(28) output
as
set @msg_output = 'The file exists'
Return 44
The second procedure does not do anything, except take input parameter and return a message output and return, this work.
since the second procedure works, it means that the code in aspx is correct, but I have no clue why it does not return output parameter and return # in the first procedure.
I would really appreciate anyone who could help.
thanks
ehx5
Hi guys,
Being new to ASP.NET, I may be asking something that is dead simple, but please bear with me!
How would I go about listing all the tables, stored procedures and views from a SQL database within an aspx page? I understand how to connect and return a dataset etc, but that's about as far as I can get. I want to be able to list all of these objects from a given db - any ideas?
Additionally (this may not be possible) - is there a way I can list all of the objects within a visual studio.net solution, again within an aspx page?
Thanks for any help,
Jon
I have searched for what I think is a simple solution.
In my aspx.vb code page, I need to make a connection to SQL Server (my connection strings are in the web.config file) and then make a simple SQL Select to return one or 2 values.
For example, the user will select a customer on the ASP form, then I need to read a couple of default values from that user's record and display them back onto the form.
Can someone provide the sample code or direct me to this? I'm thinking that this is rather simple, but I can't seem to make it work. If I see a sample of exactly what I need to do, such as reading a value using the Northwind sample DB, then I can modify it to fit my table structure, etc.
Thank you.
Hi all,
I am trying to use session in my asp.net in moss but i got the error below, eventhough i have set web.config file to enableSessionState="true" and include €œSystem.Web.SessionState.SessionStateModule". Have i miss anything? thanks
Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the \ section in the application configuration.
=================
this is what i have set.
<pages enableSessionState="true" enableViewState="true" enableViewStateMac="true" validateRequest="false" pageParserFilterType="Microsoft.SharePoint.ApplicationRuntime.SPPageParserFilter, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" asyncTimeout="7">
<namespaces>
<remove namespace="System.Web.UI.WebControls.WebParts" />
</namespaces>
<tagMapping>
<add tagType="System.Web.UI.WebControls.SqlDataSource, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" mappedTagType="Microsoft.SharePoint.WebControls.SPSqlDataSource, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
</tagMapping>
</pages>
<httpModules>
<clear />
<add name="Session" type="System.Web.SessionState.SessionStateModule" />
I am trying to use the Report Viewer Control in an ASPX page but getting the following error "For security reasons DTD is prohibited in this XML document. To enable DTD processing set the ProhibitDtd property on XmlReaderSettings to false and pass the settings into XmlReader.Create method". This is with September CTP of SQL Server 2005. I am not trying to set any DTD, the same report works if displayed using the WinForm viewer control...so I am not sure why this is happening. is there any samples available for using the Report Web viewer control in an aspx page?
Thanks
Krishna
The report seems to render just fine if a parameter has just 1 value. However, when I try to pass multi values(comma seperated) to the report from aspx - the report viewer is unable to check the selected values. I have set ShowParameterPrompts to true - for multivalues the parameter selection is blank and hence unless the values are reselected the report wont render.
I tried to loop thru the multi values by dumping it in a array and adding the individual value while iterating thru the RDL's parameter collection. In that case the error message that I get is parameter xyz has been specifed multiple times.
Has any one come across this? How to fix this?
TIA
Is it possible to call up the SubscriptionProperties.aspx page by URL for a specific report, and *specify* the parameter(s) values directly in the URL? I have a scenario where I don't want the user to have to do it.
View 3 Replies View RelatedHi,
It seems to be a logical problem. When I want to do an update of new data inserted in my aspx-page I can type in and start the updating.After the processing it jumps back on the resultpage but I notice that there was not update be done. What can be the problem.
Here the code of my aspx-page:
<%@ Page Language="VB" MasterPageFile="~/AdminMaster.master" AutoEventWireup="false" CodeFile="news.aspx.vb" Inherits="admin_news" title="Untitled Page" %><asp:Content ID="Content1" ContentPlaceHolderID="mainCopy" Runat="Server"> <br /> <h1> News bearbeiten</h1> <p> <asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" AutoGenerateRows="False" CellPadding="4" DataKeyNames="ID" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" Height="50px" Width="600px"> <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" /> <EditRowStyle BackColor="#2461BF" /> <RowStyle BackColor="#EFF3FB" /> <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" /> <Fields> <asp:CommandField /> <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" /> <asp:TemplateField HeaderText="Datum" SortExpression="Datum"> <EditItemTemplate> <asp:TextBox ID="ArtikelID" runat="server" Text='<%# Bind("Testfeld1") %>'></asp:TextBox> </EditItemTemplate> <EditItemTemplate> <asp:TextBox ID="datumTextbox" runat="server" Text='<%# Bind("Datum") %>'></asp:TextBox> </EditItemTemplate> <InsertItemTemplate> <asp:TextBox ID="datumTextbox" runat="server" Text='<%# Bind("Datum") %>'></asp:TextBox> </InsertItemTemplate> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Bind("Datum") %>'></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:BoundField DataField="Header" HeaderText="Header" SortExpression="Header" /> <asp:TemplateField HeaderText="Überschrift D"> <EditItemTemplate> <asp:TextBox ID="ArtikelID" runat="server" Text='<%# Bind("ArtikelID") %>'></asp:TextBox> </EditItemTemplate> <EditItemTemplate> <asp:TextBox ID="EditHeaderD" runat="server" Height="35px" Width="150px"></asp:TextBox> </EditItemTemplate> <InsertItemTemplate> <asp:TextBox ID="InsertHeaderD" runat="server" Height="35px" Width="150px"></asp:TextBox> </InsertItemTemplate> <ItemTemplate> <asp:Label ID="headerD" runat="server" Height="35px" Text="Label" Width="150px"></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Überschrift E"> <EditItemTemplate> <asp:TextBox ID="EditHeaderE" runat="server" Height="35px" Width="150px"></asp:TextBox> </EditItemTemplate> <InsertItemTemplate> <asp:TextBox ID="InsertHeaderE" runat="server" Height="35px" Width="150px"></asp:TextBox> </InsertItemTemplate> <ItemTemplate> <asp:Label ID="headerE" runat="server" Height="35px" Text="Label" Width="150px"></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Text D"> <EditItemTemplate> <asp:TextBox ID="EditTextD" runat="server" Height="35px" Width="400px"></asp:TextBox> </EditItemTemplate> <InsertItemTemplate> <asp:TextBox ID="InsertTextD" runat="server" Height="35px" Width="400px"></asp:TextBox> </InsertItemTemplate> <ItemTemplate> <asp:Label ID="TextD" runat="server" Height="35px" Text="Label" Width="400px"></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Text E"> <EditItemTemplate> <asp:TextBox ID="EditTextE" runat="server" Height="35px" Width="400px"></asp:TextBox> </EditItemTemplate> <InsertItemTemplate> <asp:TextBox ID="InsertTextE" runat="server" Height="35px" Width="400px"></asp:TextBox> </InsertItemTemplate> <ItemTemplate> <asp:Label ID="TextE" runat="server" Height="35px" Text="Label" Width="400px"></asp:Label> </ItemTemplate> </asp:TemplateField> <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowInsertButton="True" /> </Fields> <FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" /> <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" /> <AlternatingRowStyle BackColor="White" /> </asp:DetailsView> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:connpferde %>" DeleteCommand="DELETE FROM [News_Kultur] WHERE [ID] = @ID" InsertCommand="INSERT INTO [News_Kultur] ([ArtikelID], [NewsID], [Header], [Ueberschrift_D], [Ueberschrift_E], [Text_D], [Text_E], [Datum]) VALUES (@ArtikelID, @NewsID, @Header, @Ueberschrift_D, @Ueberschrift_E, @Text_D, @Text_E, @Datum)" SelectCommand="SELECT * FROM News_Kultur LEFT JOIN News ON News_Kultur.NewsID = News.ID;" UpdateCommand="UPDATE News SET Datum = @Datum WHERE ID=@NewsID"> <DeleteParameters> <asp:Parameter Name="ID" Type="Int16" /> </DeleteParameters> <UpdateParameters> <asp:Parameter Name="ArtikelID" Type="Int16" /> <asp:Parameter Name="NewsID" Type="Int32" /> <asp:Parameter Name="Header" Type="String" /> <asp:Parameter Name="Ueberschrift_D" Type="String" /> <asp:Parameter Name="Ueberschrift_E" Type="String" /> <asp:Parameter Name="Text_D" Type="String" /> <asp:Parameter Name="Text_E" Type="String" /> <asp:Parameter Name="Datum" Type="DateTime" /> <asp:Parameter Name="ID" Type="Int32" /> </UpdateParameters> <InsertParameters> <asp:Parameter Name="Header" Type="String" /> <asp:Parameter Name="Ueberschrift_D" Type="String" /> <asp:Parameter Name="Ueberschrift_E" Type="String" /> <asp:Parameter Name="Text_D" Type="String" /> <asp:Parameter Name="Text_E" Type="String" /> <asp:Parameter Name="Datum" Type="DateTime" /> </InsertParameters> </asp:SqlDataSource> </p></asp:Content>and here for completion the code of my codebehindpage:
Imports Microsoft.VisualBasicImports SystemImports System.DataImports system.Data.SqlClientImports System.WebImports System.XmlPartial Class admin_news Inherits System.Web.UI.Page Protected Sub DetailsView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles DetailsView1.DataBound If DetailsView1.CurrentMode = DetailsViewMode.Insert Then DirectCast(DetailsView1.FindControl("datumTextbox"), TextBox).Text = Now End If If DetailsView1.CurrentMode = DetailsViewMode.Edit Then DirectCast(DetailsView1.FindControl("datumTextbox"), TextBox).Text = Now End If End Sub 'Prozedur wird bei Update ausgeführt Public Sub DetailView1_ItemUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewUpdatedEventArgs) Handles DetailsView1.ItemUpdated If Not IsDate(e.NewValues("Datum")) Then Exit Sub End If Dim conn As New SqlConnection(ConfigurationManager.ConnectionStrings("connpferde").ConnectionString) conn.Open() Dim cmd As New SqlCommand cmd.Connection = conn cmd.CommandText = "UPDATE News_Kultur SET Header = @Header,Ueberschrift_D=@Ueberschrift_D,Ueberschrift_E=@Ueberschrift_E,Text_D=@Text_D,Text_E=@Text_E JOIN News_Kultur.NewsID=News.ID WHERE News_Kultur.ID=@ArtikelID " cmd.Parameters.Add(New SqlParameter("@ArtikelID", e.NewValues("ArtikelID"))) cmd.Parameters.Add(New SqlParameter("@Header", e.NewValues("Header"))) cmd.Parameters.Add(New SqlParameter("@Ueberschrift_D", e.NewValues("Ueberschrift_D"))) cmd.Parameters.Add(New SqlParameter("@Ueberschrift_E", e.NewValues("Ueberschrift_E"))) cmd.Parameters.Add(New SqlParameter("@Text_D", e.NewValues("Text_D"))) cmd.Parameters.Add(New SqlParameter("@Text_E", e.NewValues("Text_E"))) End SubEnd Class
RegardsRuprecht Helms
www.rheyn.de
Dear i am using visual studio.net.......... when i connect database (in sqlserver) using sqldataAdapter with datagrid in visual basic.net every thing work properly........... but when i use the same in asp.net then i get an error message on the resultant explorer page give below.
Server Error in '/studentData' Application.
--------------------------------------------------------------------------------
Login failed for user 'RAMIZSARDARASPNET'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user 'RAMIZSARDARASPNET'.
Source Error:
Line 85: 'Put user code to initialize the page here
Line 86: Dim ds As New DataSet()
Line 87: SqlDataAdapter1.Fill(ds)
Line 88: DataGrid1.DataSource = ds.Tables(0)
Line 89: DataGrid1.DataBind()
Source File: c:inetpubwwwrootstudentDataWebForm1.aspx.vb Line: 87
Stack Trace:
[SqlException: Login failed for user 'RAMIZSARDARASPNET'.]
System.Data.SqlClient.SqlConnection.Open()
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState)
System.Data.Common.DbDataAdapter.Fill(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
studentData.WebForm1.Page_Load(Object sender, EventArgs e) in c:inetpubwwwrootstudentDataWebForm1.aspx.vb:87
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.0.3705.0; ASP.NET Version:1.0.3705.0
Plz solve my problem and Reply me on ramiz_ch@hotmail.com
Plz solve my problem and Reply me on ramiz_ch@hotmail.com
Plz solve my problem and Reply me on ramiz_ch@hotmail.com
Ramiz
hi to all,
I am using Sql server reporting services.When i have create a report .rdl file and deploy it on Report server and than display that report on my application's .aspx page in pdf format using web services , every thing is perfactly working in my senario at the starting time but now i faced a problem with that. When record goes more than 2000 (in my senario a single record disply in a one report pdf page means for 2000 record in table that means its display in 2000 pdf page as with next forward option of pdf view),So in that cas it doesn't work, did now show any report and give the error as
ex.Message"Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'.
The request failed with the error message:
--
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Server Unavailable
</title>
</head>
<body>
<h1><span style="font-family:Verdana;color: #ff3300">Server Application Unavailable
</span></h1>
<p>
<span style="font-family:Verdana;">
The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request.
</span></p>
<p>
<b>Administrator Note:
</b> An error message detailing the cause of this specific request failure can be found in the application event log of the web server. Please review this log entry to discover what caused this error to occur.
</p>
</body>
</html>
--."string
Any body have any idea please help me as soon as possible.
urgently--- any help will be appriciate.
thanks in advance.
arvind
My problem, I have the aspx, .cs and ascx files but I don t have a project or solution that came with the files (since that was done by front page). So I need to add all those files in a solution or a project so that I can maintain the site that was created by front page using Visula Studio.
Do you know how i Can put all those files in a new project or new solution.
2/Also, when we modify the the pages, how can i put them beck in the site, will I have to compile the files again, or not. thank you.
Thank you
Hi
How to bring Report builder in the Ui of .net aspx pages?
I tryed withe the .exe but it is comming with a new process and come up with new IDE of Report builder, i donot required this,
I want it should come up within the Aspx page itself.
any input will be helpfull for me.
regrads
Bibek
I created a report with a parameter. The parameter was created using a dataset in the report designer. This works fine. I deployed the report (webhost4life) and the report runs fine in the report manager. I am able to select my casenumber click on the default view report button and it works.
Problem: I embedd the report into an aspx page frmReports1.aspx. I call this page from another page (form). the frmReports.aspx page comes up and displays the default drop down list box with the casenumbers (fine). I select the casenumber and click on the view report button and NOTHING. I here the postbacks taking place but all that happens is the default value appears in the drop down list box and the toolbar shows. I checked permissions and everything is fine. I searched the forum and thought i found the solution with the inLine HTML and Async (still nothing) I can only think that something is not going right with the parameter. Here is my html, and code behind code. any help would be greatly apprcieated.
Zachary
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="frmReports1.aspx.vb" Inherits="frmReports1" %>
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<%@ Register Assembly="Microsoft.ReportViewer.WebForms, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
Namespace="Microsoft.Reporting.WebForms" TagPrefix="rsweb" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<style>html,body,form {height:100%}</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<rsweb:ReportViewer ID="rvTest" runat="server" Width="600px" ProcessingMode="Remote" AsyncRendering="false" Height="75%" >
<ServerReport
DisplayName="Billable Hours"
ReportPath="/sddmtech/SnowandIce/rptHoursWorked"
ReportServerUrl="http://sqlreport01.mysite4now.com/Reportserver" />
</rsweb:ReportViewer>
</div>
</form>
</body>
</html>
aspx code behind
Imports System.Net
Imports System.Security.Principal
Imports Microsoft.Reporting.WebForms
Partial Class frmReports1
Inherits System.Web.UI.Page
Protected Sub rvTest_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles rvTest.Init
End Sub
<Serializable()> _
Public NotInheritable Class MyReportServerCredentials
Implements IReportServerCredentials
Public ReadOnly Property ImpersonationUser() As WindowsIdentity _
Implements IReportServerCredentials.ImpersonationUser
Get
Return Nothing
End Get
End Property
Public ReadOnly Property NetworkCredentials() As ICredentials _
Implements IReportServerCredentials.NetworkCredentials
Get
' Put your login and password here this works fine
Dim userName As String = ""
Dim password As String = ""
Dim domain As String = ""
Return New NetworkCredential(userName, password, domain)
'********************************************************************************
End Get
End Property
Public Function GetFormsCredentials(ByRef authCookie As System.Net.Cookie, ByRef userName As String, ByRef password As String, ByRef authority As String) As Boolean Implements Microsoft.Reporting.WebForms.IReportServerCredentials.GetFormsCredentials
End Function
End Class
Public Function GetFormsCredentials(ByRef authCookie As Cookie, _
ByRef userName As String, _
ByRef password As String, _
ByRef authority As String) _
As Boolean
authCookie = Nothing
userName = Nothing
password = Nothing
authority = Nothing
'Not using form credentials
Return False
End Function
Protected Sub form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles form1.Load
'ReportViewer1.ServerReport.ReportServerCredentials = New MyReportServerCredentials()
'rvTest.ServerReport.Refresh()
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
rvTest.ServerReport.ReportServerCredentials = New MyReportServerCredentials()
End Sub
End Class