Friday, February 24, 2012
'aspnet_regiis' impact on classic ASP?
We want to install RS on a Windows 2003 / IIS 6 server.
Does it hurt our 'classic' (pre .net) ASP aps if we run aspnet_regiis -i
on this machine?
tanx,
Derk JanWe have classic ASP and ASP.NET running on the same server just fine. Since
ASP.NET uses different file extensions (aspx), it shouldn't hurt.
Nevertheless, a system backup -- or trying it first on a dev server -- is
always a good idea.
--
Cheers,
'(' Jeff A. Stucker
\
Business Intelligence
www.criadvantage.com
---
"Derk Jan" <DerkJan@.discussions.microsoft.com> wrote in message
news:6BDE0622-F903-48D8-B419-4D6BD497FD0F@.microsoft.com...
> Hi,
> We want to install RS on a Windows 2003 / IIS 6 server.
> Does it hurt our 'classic' (pre .net) ASP aps if we run aspnet_regiis -i
> on this machine?
> tanx,
> Derk Jan
>
Thursday, February 9, 2012
ASP.NET 2.0 / ASP and SQL Server 2005
I can't get the app to connect to the DB at all. If I use the exact same connection string that works in an asp.net 2.0 app on the same server, it doesn't work. I don't even have to do a query, merely opening the connection will break it.
I use...
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.open "Data Source=********;Initial Catalog=intranet_database;Integrated Security=True" '(that's the connection string that works just fine on the asp.net app)
I get..
Microsoft OLE DB Service Components error '80040e21'
Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
/v1/testing/default.asp, line 13
Most of the stuff I can see relates to datatypes and so on, but given the above I can't see how that might be.
Any ideas? Please! ;-)
I solved this by creating a black UDL file on the desktop and it generated a very different connection string. When I try and grant the ISR_MACHINENAME user access to the database I keep getting this not very helpful error message.
|||
Can't you edit a post? What I meant to say was...
Yeskin Gallen:
I solved this by creating a blank UDL file on the desktop and it generated a very different connection string. When I try and grant the IUSR_MACHINENAME user access to the database I keep getting this not very helpful error message...
TITLE: Microsoft SQL Server Management Studio
----------
Cannot show requested dialog.
----------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
----------
The server principal "BEL-INTRANET-01\IUSR_BEL-INTRANET-01" is not able to access the database "self-builder-v1" under the current security context. (Microsoft SQL Server, Error: 916)
For help, click:http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1399&EvtSrc=MSSQLServer&EvtID=916&LinkId=20476
----------
BUTTONS:
OK
----------
asp.net 2, sql2005, double data rows
I'm stumped. When using the classic asp page, the table produced on the web has 4 rows. But, when using the asp.net 2.0 side against the same stored proc, I get double the rows - 8. However, when I pull from the sql table directly there are only 4 rows. Any ideas? I've looked at this far too many hours...
da = New Data.SqlClient.SqlDataAdapter("pTblTempDisplayInsert2 0,'" & coList & "','" & tblList & "','" & varTblNameT & "'", cn)da.Fill(ds, "myTables")For Each drow As System.Data.DataRow In ds.Tables("myTables").Rows varTxt &= drow.Item("titleID") & "<br />"Next I get:1852
1850
2055
2053
1852
1850
2055
2053
If I run the last line of the stored procedure with the variable table name filled in:
SELECT d.titleID FROM ##varTblName d LEFT JOIN xtblTitles t ON d.tblID=t.tblID LEFT JOIN tblStatTitles s ON d.titleID=s.titleID LEFT JOIN xtblURL u ON u.urlID=t.urlID ORDER BY d.tblID, d.[year], d.lineOrder, d.countyIDI get:
1852
1850
2055
2053
If I do a simple select * from ##varTableName, I get four rows...
Thanks,
Janet
First, parameterize your query, then post if you still have an issue.
dim cmd as new sqlcommand("sp_MySP",conn)
cmd.commandtype=storedproc ' not correct property or value, but something similiar
cmd.parameters.add("coList",sqldbtype.varchar).value=colist
cmd.parameters.add ...
cmd.parameters.add ...
da=new sqldataadapter(cmd)
...
|||
Thanks SO much for replying. Okay, here you go... I'm going to show the call to the stored proc from both sides (a test aspx/aspx) the values, and the params for the aspx. Sorry it's so much, but since it works on one page and not the other, I'm obviously missing something...
test.aspx (correct-same as old asp):
<%@. Import Namespace="System.Data.SqlClient" %>
<%@. Import Namespace="System.Web.UI.WebControls" %>
<%@. Import Namespace="System.Data" %>
<%@. Page Language="VB" debug="True"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<script runat="server">
Sub Page_load(ByVal sender As Object, ByVal e As EventArgs)
Dim strConn As String = ConfigurationManager.ConnectionStrings("strConnCEguest").ConnectionString
Dim cn As New Data.SqlClient.SqlConnection(strConn)
Dim ds As New Data.DataSet
Dim da As New Data.SqlClient.SqlDataAdapter
Dim coList As String, tblList As String, varTxt As String, varTblNameT As String
tblList = "(101)"
coList = "(21)"
varTblNameT = "curly"
varTxt = "coList=" & coList & "<br />tblList=" & tblList & "<br />"da = New Data.SqlClient.SqlDataAdapter("chad.dbo.pTblTempDisplayInsert2", cn)
da.SelectCommand.CommandType = Data.CommandType.StoredProcedure
da.SelectCommand.Parameters.Add(New Data.SqlClient.SqlParameter("@.year", Data.SqlDbType.Int, 1))
da.SelectCommand.Parameters("@.year").Value = 0
da.SelectCommand.Parameters.Add(New Data.SqlClient.SqlParameter("@.coID", Data.SqlDbType.VarChar, 100))
da.SelectCommand.Parameters("@.coID").Value = coList
da.SelectCommand.Parameters.Add(New Data.SqlClient.SqlParameter("@.tblID", Data.SqlDbType.VarChar, 500))
da.SelectCommand.Parameters("@.tblID").Value = tblList
da.SelectCommand.Parameters.Add(New Data.SqlClient.SqlParameter("@.tblName", Data.SqlDbType.VarChar, 25))
da.SelectCommand.Parameters("@.tblName").Value = varTblNameT
da.Fill(ds, "writeTables")varTxt &= "chad.dbo.pTblTempDisplayInsert2" & da.SelectCommand.Parameters("@.year").Value & "," & da.SelectCommand.Parameters("@.coID").Value & "," & da.SelectCommand.Parameters("@.tblID").Value & "," & da.SelectCommand.Parameters("@.tblName").Value & "<br />"
For Each drow As System.Data.DataRow In ds.Tables("writeTables").Rows
varTxt &= drow.Item("titleID") & "<br />"
Next
lblMsg.Text = varTxt
End Sub
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="lblMsg" runat="server"></asp:Label>
</div>
</form>
</body>
</html>
I get:
coList=(21)
tblList=(101)
chad.dbo.pTblTempDisplayInsert2 0,(21),(101),curly
1852
1850
2055
2053
select.aspx code (incorrect):
<asp:Content ID="Content2" ContentPlaceHolderID="contentHolder" Runat="Server">
<p><asp:Label ID="lblMsg" runat="server" /></p><asp:PlaceHolder ID="selectForm" runat="server"><span class="small">
<table border="0" cellpadding="5" cellspacing="0">
<tr><td colspan="2"><asp:CheckBoxList ID="chkCounty" runat="server" RepeatDirection="Vertical" RepeatColumns="3" /><td></tr>
<tr><td><asp:DropDownList ID="ddlCat" runat="server /></td>
<td><asp:RadioButtonList ID="radioSex" runat="server" RepeatLayout="Flow" RepeatDirection="Horizontal" >
<asp:ListItem Value="0" Text="All genders" Selected></asp:ListItem>
<asp:ListItem Value="1" Text="Male"></asp:ListItem>
<asp:ListItem Value="2" Text="Female"></asp:ListItem>
</asp:RadioButtonList></td></tr>
<tr><td><asp:DropDownList ID="ddlSource" runat="server /></td><td><asp:DropDownList ID="ddlAge" runat="server /></td></tr>
<tr><td ><asp:TextBox runat="server" id="keywords" Columns="10 /></td>
<td><asp:RadioButtonList ID="radioRace" runat="server" RepeatLayout="Flow" RepeatDirection="Horizontal" >
<asp:ListItem Value="0" Text="NA" Selected="true"></asp:ListItem>
<asp:ListItem Value="1" Text="Designated"></asp:ListItem>
</asp:RadioButtonList></td></tr>
<tr><td></td><td><asp:RadioButtonList ID="radioHisp" runat="server" RepeatLayout="Flow" RepeatDirection="Horizontal" >
<asp:ListItem Value="0" Text="NA" Selected="true"></asp:ListItem>
<asp:ListItem Value="1" Text="Designated"></asp:ListItem>
</asp:RadioButtonList></td></tr>
<asp:TextBox id="txtYear" runat="server" text="0" Visible="false" />
<tr><td colspan="2"><asp:Button runat="server" ID="btnSubmit" Text="Submit" /></td></tr></table>
</asp:PlaceHolder>
<asp:PlaceHolder ID = "selectList" runat="server">
<asp:Button ID="btnSelectList" Text="Submit" OnClick="chkSelectedItems" runat="server" />
<asp:CheckBoxList ID="chkSelectList" RepeatDirection= "Vertical" runat="server" />
</asp:PlaceHolder>
</asp:Content>Partial Class chad_select
Inherits System.Web.UI.Page
Public strConn As String = ConfigurationManager.ConnectionStrings("blah").ConnectionString
Public cn As New Data.SqlClient.SqlConnection(strConn)
Public ds As New Data.DataSet
Public da As New Data.SqlClient.SqlDataAdapter
Public coList2 As StringProtected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
selectForm.Visible = "True"
selectList.Visible = "False"
tableDisplay.Visible = "False"
da = New Data.SqlClient.SqlDataAdapter("chad.dbo.pCountyList 0", cn)
da.Fill(ds, "county")
chkCounty.DataSource = ds.Tables("county")
chkCounty.DataTextField = ds.Tables("county").Columns("county").ColumnName.ToString()
chkCounty.DataValueField = ds.Tables("county").Columns("countyID").ColumnName.ToString()da = New Data.SqlClient.SqlDataAdapter("chad.dbo.pCategoriesList 0", cn)
da.Fill(ds, "category")
ddlCat.DataSource = ds.Tables("category")
ddlCat.DataTextField = ds.Tables("category").Columns("category").ColumnName.ToString()
ddlCat.DataValueField = ds.Tables("category").Columns("catID").ColumnName.ToString()da = New Data.SqlClient.SqlDataAdapter("chad.dbo.pAgeGroupList 0", cn)
da.Fill(ds, "ages")
ddlAge.DataSource = ds.Tables("ages")
ddlAge.DataTextField = ds.Tables("ages").Columns("ageGroup").ColumnName.ToString()
ddlAge.DataValueField = ds.Tables("ages").Columns("ageID").ColumnName.ToString()
ddlAge.SelectedIndex = 0da = New Data.SqlClient.SqlDataAdapter("chad.dbo.pSourceList 0", cn)
da.Fill(ds, "source")
ddlSource.DataSource = ds.Tables("source")
ddlSource.DataTextField = ds.Tables("source").Columns("source").ColumnName.ToString()
ddlSource.DataValueField = ds.Tables("source").Columns("sourceID").ColumnName.ToString()
ddlSource.SelectedIndex = 0
Page.DataBind()
End If
End SubProtected Sub getList(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
If chkCounty.SelectedIndex = -1 Then
lblMsg.ForeColor = Drawing.Color.Crimson
lblMsg.Text = " ~ You must select at least one county."
selectForm.Visible = "True"
selectList.Visible = "False"
tableDisplay.Visible = "False"
Else
Dim varCat As Int32 = ddlCat.SelectedValue
Dim varSrc As Int32 = ddlSource.SelectedValue
Dim varAge As Int32 = ddlAge.SelectedValue
Dim varYear As Int32 = txtYear.Text
Dim varDisc As Int32 = txtDisp.Text
Dim varKey As String
If keywords.Text = "" Then varKey = "" Else varKey = keywords.TextFor Each li As ListItem In chkCounty.Items
If li.Selected Then coList2 += "," & li.Value
Next
coList2 = Right(coList2, Len(coList2) - 1)da = New Data.SqlClient.SqlDataAdapter("chad.dbo.pMultipleCounties '" & coList2 & "'", cn)
da.Fill(ds, "county")lblMsg.ForeColor = Drawing.Color.Black
lblMsg.Text = "Your Selections: County(ies)="
Dim dr As Data.DataRow
For Each dr In ds.Tables("county").Rows
lblMsg.Text &= Trim(dr("county")) & ", "
Next
lblMsg.Text = Left(lblMsg.Text, Len(lblMsg.Text) - 2)
lblMsg.Text &= "; Category:"
If (ddlCat.SelectedIndex = -1) Or (Convert.ToInt32(ddlCat.SelectedValue) = 0) Then
lblMsg.Text &= "All"
Else
da = New Data.SqlClient.SqlDataAdapter("chad.dbo.pCategoriesList " & varCat, cn)
da.Fill(ds, "category")
lblMsg.Text &= ds.Tables("category").Rows(0).Item("category")
End If
lblMsg.Text &= "; Age group: "
If (ddlAge.SelectedIndex = -1) Or (Convert.ToInt32(ddlAge.SelectedValue) = 0) Then
lblMsg.Text &= "All"
Else
da = New Data.SqlClient.SqlDataAdapter("chad.dbo.pAgeGroupList " & varAge, cn)
da.Fill(ds, "ages")
lblMsg.Text &= ds.Tables("ages").Rows(0).Item("ageGroup")
End If
lblMsg.Text &= "; Source: "
If (ddlSource.SelectedIndex = -1) Or (Convert.ToInt32(ddlSource.SelectedValue) = 0) Then
lblMsg.Text &= "All"
Else
da = New Data.SqlClient.SqlDataAdapter("chad.dbo.pSourceList " & varSrc, cn)
da.Fill(ds, "source")
lblMsg.Text &= ds.Tables("source").Rows(0).Item("Source")
End If
If Convert.ToInt32(radioRace.SelectedValue) = 0 Then
lblMsg.Text &= "; Race: All"
Else
lblMsg.Text &= "; Race: Designated"
End If
If Convert.ToInt32(radioHisp.SelectedValue) = 0 Then
lblMsg.Text &= "; Hispanic Ethnicity: All"
Else
lblMsg.Text &= "; Hispanic Ethnicity: Designated"
End If
Select Case Convert.ToInt32(radioSex.SelectedValue)
Case 0
lblMsg.Text &= "; Gender: All"
Case 1
lblMsg.Text &= "; Gender: Male"
Case 2
lblMsg.Text &= "; Gender: Female"
End Select
If varKey = "" Then
lblMsg.Text &= "; Keywords: NA"
Else
lblMsg.Text &= "; Keywords: " & varKey
End Ifda = New Data.SqlClient.SqlDataAdapter("chad.dbo.spSelectTblList " & varSrc & "," & varCat & "," & varAge & "," & Convert.ToInt32(radioSex.SelectedValue) & "," & Convert.ToInt32(radioRace.SelectedValue) & "," & Convert.ToInt32(radioHisp.SelectedValue) & ",0,'" & varKey & "','" & coList2 & "'", cn)
da.Fill(ds, "selectList")
If ds.Tables("selectList").Rows.Count > 0 Then
chkSelectList.DataSource = ds.Tables("selectList")
chkSelectList.DataTextField = "myTitle"
chkSelectList.DataValueField = "tblID"
chkSelectList.DataBind()lblMsg.Visible = "True"
selectForm.Visible = "False"
selectList.Visible = "True"
tableDisplay.Visible = "False"
Else
lblMsg.Text = "There were no items matching your selection criteria. Please try again."
lblMsg.ForeColor = Drawing.Color.Crimson
lblMsg.Visible = "True"
selectForm.Visible = "True"
selectList.Visible = "False"
tableDisplay.Visible = "False"
End If
End If
End SubProtected Sub chkSelectedItems(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSelectList.Click
If chkSelectList.SelectedIndex = -1 Then
lblMsg.ForeColor = Drawing.Color.Crimson
lblMsg.Text = " ~ You must select at least one table."
selectForm.Visible = "False"
selectList.Visible = "True"
tableDisplay.Visible = "False"
Else
Dim varTblNameT As String
varTblNameT = "harry2"
Dim varTxt As String = Nothing
Dim coList As String = Nothing
Dim tblList As String = Nothing'get tables
For Each li2 As ListItem In chkSelectList.Items
If li2.Selected = True Then
tblList &= Convert.ToString(li2.Value) & ","
End If
Next
tblList = "(" & Left(tblList, Len(tblList) - 1) & ")"'get counties
For Each li As ListItem In chkCounty.Items
If li.Selected = True Then
coList &= Convert.ToString(li.Value) & ","
End If
Next
coList = "(" & Left(coList, Len(coList) - 1) & ")"varTxt = "coList=" & coList & "<br />tblList=" & tblList & "<br />"
da = New Data.SqlClient.SqlDataAdapter("chad.dbo.pTblTempDisplayInsert2", cn)
da.SelectCommand.CommandType = Data.CommandType.StoredProcedure
da.SelectCommand.Parameters.Add(New Data.SqlClient.SqlParameter("@.year", Data.SqlDbType.Int, 1))
da.SelectCommand.Parameters("@.year").Value = 0
da.SelectCommand.Parameters.Add(New Data.SqlClient.SqlParameter("@.coID", Data.SqlDbType.VarChar, 100))
da.SelectCommand.Parameters("@.coID").Value = coList
da.SelectCommand.Parameters.Add(New Data.SqlClient.SqlParameter("@.tblID", Data.SqlDbType.VarChar, 500))
da.SelectCommand.Parameters("@.tblID").Value = tblList
da.SelectCommand.Parameters.Add(New Data.SqlClient.SqlParameter("@.tblName", Data.SqlDbType.VarChar, 25))
da.SelectCommand.Parameters("@.tblName").Value = varTblNameT
da.Fill(ds, "writeTables")
varTxt &= "chad.dbo.pTblTempDisplayInsert2" & da.SelectCommand.Parameters("@.year").Value & "," & da.SelectCommand.Parameters("@.coID").Value & "," & da.SelectCommand.Parameters("@.tblID").Value & "," & da.SelectCommand.Parameters("@.tblName").Value & "<br />"
For Each drow As System.Data.DataRow In ds.Tables("writeTables").Rows
varTxt &= drow.Item("titleID") & "<br />"
Next
lblMsg.Text = varTxt
lblMsg.Visible = "True"
selectForm.Visible = "False"
selectList.Visible = "False"
tableDisplay.Visible = "True"
End If
End SubEnd Class
I get:
coList=(21)
tblList=(101)
chad.dbo.pTblTempDisplayInsert2 0,(21),(101),harry2
1852
1850
2055
2053
1852
1850
2055
2053
When I do a pull from the very last execution of the stored procedure I only get 4 lines: (SELECT * FROM ##harry2 d LEFT JOIN dbo.xtblTitles t ON d.tblID=t.tblID LEFT JOIN dbo.tblStatTitles s ON d.titleID=s.titleID LEFT JOIN chad.dbo.xtblURL u ON u.urlID=t.urlID)
Thanks for anything you can point to... Janet
Two things I would try, since I'm not seeing it:
Right before your da.fill(ds,"writetables") do ds=new dataset just to make sure the dataset is empty. Then I would try running the following in query analyzer/MMS
EXEC chad.dbo.pTblTempDisplayInsert2 0,(21),(101),harry2
EXEC chad.dbo.pTblTempDisplayInsert2 0,(21),(101),harry2
And see what it returns. Does it return 8 rows in the second resultset?
And then of course, I would run Sql Profiler to see the exact commands the web application is sending and in what order, then I would copy them one by one to query analyzer and execute them and see what is getting returned. I notice you are using temporary tables in your SP's. Is it possible that the data is being added to the temporary tables without being cleared out first?
|||Well, piss-moan-complain-cheer! The ds=new dataset did the trick.
But, I don't understand it. Just to be safe, I did a search on all the code for "writeTables": the table within the dataset ds. This is the only place that it is used. So, even if the dataset is open from previous placeholder events on the page, this table within the dataset is only used for the first time with the btn click event, so why the doubling?
I'd appreciate your input, I'm new to this, obviously, and would like to try to understand it a bit more... And, I can't thank you enough for taking your time to look at this for me.
Janet