Business Logic In Stored Proc VS Aspx.vb Page
Jul 20, 2005Hello,
I stuck in a delimma.
Where to put the business logic that involves only one update
but N number of selects from N tables........with N where conditions
Hello,
I stuck in a delimma.
Where to put the business logic that involves only one update
but N number of selects from N tables........with N where conditions
I am working with stored procedures to provide conditional business logic for a customer based on triggers. Is it possible for a stored procedure to execute an external program ie opening or distributing a crystal report?
View 9 Replies View RelatedHi,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 My stored proceddure "My Programs" includes a parameter @meid.How do I code an aspx file to run the procedure with a user ID, e.g. EmpID?I tried the following codes, but the error message indicated it can not findthe Stored Procedure. How do I pass the EmpID as a Stored Procedure parameter?
<%meid = EmpIdcmd.CommandText = "MyPrograms meid"cmd.CommandType = CommandType.StoredProcedurecmd.Connection = sqlConnection2sqlConnection2.Open()reader3 = cmd.ExecuteReader(meid)While reader3.Read()sb.Append(reader3(i).ToString() + "......<BR> <BR /> ")End While%>
TIA,Jeffrey
Hello, I have the following stored procedure and the following aspx page. I am trying to connect this aspx page to the stored procedure using the SqlDataSource. When the user enters a branch number in textbox1, the autonumber generated by the database is returned in textbox2. I am not quite sure what to do to get this to execute. Can someone provide me assistance? Will I need to use some vb.net code behind?
Stored ProcedureCREATE PROCEDURE InsertNearMiss @Branch Int, @Identity int OUT ASINSERT INTO NearMiss (Branch)VALUES (@Branch)
SET @Identity = SCOPE_IDENTITY()
GO
ASPX Page
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NearMissConnectionString %>" InsertCommand="InsertRecord" InsertCommandType="StoredProcedure" SelectCommand="InsertRecord" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:ControlParameter ControlID="TextBox1" Name="Branch" PropertyName="Text" Type="Int32" /> <asp:ControlParameter ControlID="TextBox2" Direction="InputOutput" Name="Identity" PropertyName="Text" Type="Int32" /> </SelectParameters> <InsertParameters> <asp:Parameter Name="Branch" Type="Int32" /> <asp:Parameter Direction="InputOutput" Name="Identity" Type="Int32" /> </InsertParameters> </asp:SqlDataSource> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
I have a stored procedure when query a big table about 500,000 records. When I run the stored procedure in the query analyzer, it is very fast and it only takes 2~3 seconds. However, when my aspx page try to call this stored-procedure with a Command's ExecuteReader method like bellow:
SqlDataReader myReader = myCommand.ExecuteReader();
I always get timeout expired exception. I try to set the connection timeout and command timeout to 100 seconds. The exception is gone but the average execution time is about 25 seconds! While the stored-procedure only takes about 2~3 seconds in query analyzer with the same parameter.
What could be the problem?? I tried to figure this out for a couple days but still no clue.
Thanks.
Hello,
I have a table which gets updated roughly every 6 seconds with data. I have setup an aspx page with a datagrid to meta tag refresh every 3 seconds.
Because the data sometimes stops for a couple of minutes or even hours, I was thinking of a way to update/refresh the aspx page only when the table data gets entered ( to stop page flickering every 3 seconds).
I was thinking about a stored procedure and using an on update procedure.
Does anyone have any preffered methods or suggestions on the best way to accomplish this task.
I use VB.Net
Thanks
Goong
Hi, I wanted to know that can we access a webpagefrom a store procedure in sql server 2000 like we run a exe file from sql server. Bye.
View 1 Replies View RelatedHi
I have coded the simple login page in vb .net which calls the stored proc to verify whether the user login details exists in the database. The stored procudure returns data back when I execute it in the SQL SERVER Management studio. But when I execute the stored proc in the 'Run stored Proc' wizard' , it is not retuning any data back. Connection string works fine as another SQL select command returns data in the same page.. I have included the VB code . Please help me to sort out this problem.Thank you.
If Not ((txtuser.Text = "") Or (txtpassword.Text = "")) Then
Dim conn As New SqlConnection()
conn.ConnectionString = Session("constr")
conn.Open()
Dim cmd As New SqlCommand("dbo.CheckLogin", conn)
cmd.CommandType = CommandType.StoredProcedure
' Create a SqlParameter for each parameter in the stored procedure.
Dim usernameParam As New SqlParameter("@userName", SqlDbType.VarChar, 10)
usernameParam.Value = Trim(txtuser.Text)
Dim pswdParam As New SqlParameter("@password", SqlDbType.NVarChar, 10)
pswdParam.Value = Trim(txtpassword.Text)
Dim useridParam As New SqlParameter("@userid", SqlDbType.NChar, 5)
Dim usercodeParam As New SqlParameter("@usercode", SqlDbType.VarChar, 10)
Dim levelParam As New SqlParameter("@levelname", SqlDbType.VarChar, 50)
'IMPORTANT - must set Direction as Output
useridParam.Direction = ParameterDirection.Output
usercodeParam.Direction = ParameterDirection.Output
levelParam.Direction = ParameterDirection.Output
'Finally, add the parameter to the Command's Parameters collection
cmd.Parameters.Add(usernameParam)
cmd.Parameters.Add(pswdParam)
cmd.Parameters.Add(useridParam)
cmd.Parameters.Add(usercodeParam)
cmd.Parameters.Add(levelParam)
Dim reader1 As SqlDataReader
Try
If conn.State = ConnectionState.Closed Then
conn.Open()
End If
Try
reader1 = cmd.ExecuteReader
Using reader1
If reader1.Read Then
Response.Write(CStr(reader1.Read))
Session("userid") = reader1.GetValue(0)
Session("usercode") = CStr(usercodeParam.Value)
Session("level") = CStr(levelParam.Value)
Server.Transfer("home.aspx")
Else
ErrorLbl.Text = "Inavlid Login. Please Try logging again" & Session("userid") & Session("usercode") & Session("level")
End If
End Using
Catch ex As InvalidOperationException
ErrorLbl.Text = ex.ToString()
End Try
Finally
If conn.State <> ConnectionState.Closed Then
conn.Close()
End If
End Try
Else
ErrorLbl.Text = "Please enter you username and password"
End If
Or maybe it can't find something it's looking for to make my additional symetrical with everything else. This is from one of my businesslogic files. What causes Visual Studio to not allow me to add something here and have it behave like the other parameters/ I'm talking about ShortDesc. Visual studio inserted () and the Get instead of GET like all the others. It would not allow me to capitalize the "get". There has to be a reason for this. Currently my program is adding all of the fields except the ShortDesc to the table in my database. Does anyone have any thoughts as to why this is the case?
#Region "Pvt Members" Private _ArticleID As System.Int32 Private _UserID As System.Int32 Private _WebSiteID As System.Int32 Private _ArticleTitle As System.String Private _Author As System.String Private _ShortDesc As System.String Private _ArticleText As System.String Private _AnchorText As System.String Private _ShowInDirectory As System.Boolean Private _Active As System.Boolean Private _DateAdded As System.DateTime#End Region#Region "Properties" Public Property ArticleID As System.Int32 GET Return _ArticleID End Get Set(ByVal Value As System.Int32) _ArticleID= Value End Set End Property Public Property UserID As System.Int32 GET Return _UserID End Get Set(ByVal Value As System.Int32) _UserID= Value End Set End Property Public Property WebSiteID As System.Int32 GET Return _WebSiteID End Get Set(ByVal Value As System.Int32) _WebSiteID= Value End Set End Property Public Property ArticleTitle As System.String GET Return _ArticleTitle End Get Set(ByVal Value As System.String) _ArticleTitle= Value End Set End Property Public Property Author As System.String GET Return _Author End Get Set(ByVal Value As System.String) _Author= Value End Set End Property Public Property ShortDesc() As System.String Get Return _ShortDesc End Get Set(ByVal value As System.String) End Set End Property Public Property ArticleText As System.String GET Return _ArticleText End Get Set(ByVal Value As System.String) _ArticleText= Value End Set End Property Public Property AnchorText As System.String GET Return _AnchorText End Get Set(ByVal Value As System.String) _AnchorText= Value End Set End Property Public Property ShowInDirectory As System.Boolean GET Return _ShowInDirectory End Get Set(ByVal Value As System.Boolean) _ShowInDirectory= Value End Set End Property Public Property Active As System.Boolean GET Return _Active End Get Set(ByVal Value As System.Boolean) _Active= Value End Set End Property Public Property DateAdded As System.DateTime GET Return _DateAdded End Get Set(ByVal Value As System.DateTime) _DateAdded= Value End Set End Property #End Region
Can anyone helpCREATE PROCEDURE PagedResults_New
(@startRowIndex int,
@maximumRows int
)
AS
--Create a table variable
DECLARE @TempItems TABLE
(ID int IDENTITY,
ShortListId int
)
-- Insert the rows from tblItems into the temp. table
INSERT INTO @TempItems (ShortListId)
SELECT Id
FROM shortlist SWHERE Publish = 'True' order by date DESC
-- Now, return the set of paged records
SELECT S.*, C.CategoryTitleFROM @TempItems t
INNER JOIN shortList S ON
t.ShortListId = S.Id
WHERE ID BETWEEN @startRowIndex AND (@startRowIndex + @maximumRows) - 1
GO
I am trying to call a CF web page/web service from a SQL 2005 stored proc and getting proxy info cannot be created. I cannot use stored proc 2005 CLR assembly because it will help us in creating only .asmx proxy not CFC proxy , any help would be appreciated.
exec master..xp_cmdshell 'http://wifi.abctest.com/Test/lartnerCall.cfm
Msg 15153, Level 16, State 1, Procedure xp_cmdshell, Line 1
The xp_cmdshell proxy account information cannot be retrieved or is invalid. Verify that the '##xp_cmdshell_proxy_account##' credential exists and contains valid information.
Hey guys,I have to import a csv file to my database and then add
some values to other fields based on these values. At present I use a
store procedure that does a bulk insert and then I use an update and
fetch inside the sql to perform these updates. I am not sure if this is
the best way. Is this bad, since some amount of busniess logic is in
the store procedure?If it is, how can I do this better?Thanks for the answer.
I'm trying to implement a custom conflict resolver by inheriting from
Microsoft.SqlServer.Replication.BusinessLogicSupport.BusinessLogicModule. The replication is between a SQL Server 2005 Express subscriber and a SQL Server 2005 publisher/distributer.
The problem is that the resolver class in the DLL will not load; although, it does appear to find the DLL. (If I rename the DLL I get a "file not found error"). The exact error message is:
Microsoft.SqlServer.Replication.ComErrorException
"Error loading custom class "MergeConflictHandler" from custom assembly "MergeConflictHandler",
Error : "Could not load type 'MergeConflictHandler' from assembly 'MergeConflictHandler, Version=1.0.2502.22393, Culture=neutral, PublicKeyToken=0403e50cc4dc27fa'."."}
I placed the DLL in the directory of the program that calls SynchronizationAgent.Synchronize and tried it with and without being registered in the GAC. There was no change. Interestingly, when I move the file out of that location, but register it in the GAC, the file is not found. Thinking it may be a security problem, I gave Everyone Read & Execute and Read privileges. I believe the class is actually instantiated by replmerge.exe, an apparantly unmanaged app, so I tried marking it ComVisible. No Luck.
I registered the resolver with the following T-SQL code:
sp_registercustomresolver @article_resolver = 'eClinical Notes Conflict Resolver'
, @is_dotnet_assembly = 'true'
, @dotnet_assembly_name = 'MergeConflictHandler'
, @dotnet_class_name = 'MergeConflictHandler'
, @resolver_clsid = Null
The resolver I've created is not much more than a shell at this point. It is pasted below, but I tried using the code found on MSDN character-for-character and had the same problem.
using System;
using System.Text;
using System.Data;
using System.Data.Common;
using Microsoft.SqlServer.Replication.BusinessLogicSupport;
namespace MergeConflictHandler
{
public class MergeConflictHandler :
Microsoft.SqlServer.Replication.BusinessLogicSupport.BusinessLogicModule
{
// Variables to hold server names.
private string m_PublisherName;
private string m_SubscriberName;
private string m_Artical_Name;
public MergeConflictHandler()
{
}
// Implement the Initialize method to get publication
// and subscription information.
public override void Initialize(string publisher, string subscriber, string distributor, string publisherDB, string subscriberDB,string articleName)
{
m_PublisherName = publisher;
m_SubscriberName = subscriber;
m_Artical_Name = articleName;
}
// Declare what types of row changes, conflicts, or errors to handle.
public override ChangeStates HandledChangeStates
{
get
{
return ChangeStates.UpdateConflicts;
}
}
public override ActionOnUpdateConflict UpdateConflictsHandler(DataSet publisherDataSet, DataSet subscriberDataSet, ref DataSet customDataSet, ref ConflictLogType conflictLogType, ref string customConflictMessage, ref int historyLogLevel, ref string historyLogMessage)
{
if (m_Artical_Name == "PatientAllergies")
{
// Accept the updated data in the Subscriber's data set and apply it to the Publisher.
}
return ActionOnUpdateConflict.AcceptPublisherData;
}
}
}
Does anyone have any thoughts or advice? (Help!)
hi,
i'm following steps described at: http://msdn2.microsoft.com/en-us/library/ms365150.aspx
all goes fine until step 6. of paragraph "To debug a business logic handler on a Web server using Web synchronization, or for a SQL Server Mobile Subscriber".
in my case when attaching to w3wp.exe i can only debug t-sql or native code. when i forcibly check 'managed' i get: "Unable to attach to the process. Access is denied". error picture:
http://img156.imageshack.us/my.php?image=debuggingerror7bp.jpg
i KNOW that the business logic handler gets loaded and executed because i am logging some info in it. i would be grateful for any suggestions.
TIA, kamil nowicki
Hi,
I am performing the Merge Replication of Timesheet table between SQL server 2005 and SQL CE on the Pocket PC. For one of the article, I would like to perform web synch for only those rows which have certain field set to true.
I am trying to use Business Logic Handler to implement this logic. I am using following code out of sample on MSDN web site. However I am not sure if this code gets executed for each row for a table during synch or does this get executed once for each table? The answer would help me write logic on applying synch changes only for few rows.
Thanks
public override ActionOnDataChange UpdateHandler(SourceIdentifier updateSource,
DataSet updatedDataSet, ref DataSet customDataSet, ref int historyLogLevel,
ref string historyLogMessage)
{
if (updateSource == SourceIdentifier.SourceIsPublisher)
{
//check the approved status of the timesheet
if (updatedDataSet.Tables["tbl_timesheets"].Rows[0]["ts_approved"] == true)
{
// Set the reference parameter to write the line to the log file.
historyLogMessage = updatedDataSet.Tables["tbl_timesheets"].Rows[0]["ts_id"].ToString();
// Set the history log level to the default verbose level.
historyLogLevel = 1;
// Accept the updated data in the Subscriber's data set and apply it to the Publisher.
return ActionOnDataChange.AcceptData;
}
else
{
return ActionOnDataChange.RejectData;
}
}
else
{
return base.UpdateHandler(updateSource, updatedDataSet,
ref customDataSet, ref historyLogLevel, ref historyLogMessage);
}
}
Any Help is appreciated.
Thanks
Hi allI hv made a stored procedure which printsvarious messages using Print statement(shown in bold)------------------------------------------------------------------------------ .....if (@current_date<@ed) and (@current_date>@sd) begin print 'Date Lies Between Boundary Limits' select * from membership where uid=@uid end else begin if(@pipe=1) begin if(@plan_id=1) begin print 'Monthly Plan Activated' update membership set start_date=@opt_sd,end_date=DateAdd(M,1,@opt_sd),status=@opt,pipeline=0,user_option='',plan_id=null,download_limit=20 where uid=@uid select * from membership where uid=@uid end else begin print 'Weekly Plan Activated' update membership set start_date=@opt_sd,end_date=DateAdd(D,7,@opt_sd),status=@opt,pipeline=0,user_option='',plan_id=null,download_limit=10 where uid=@uid select * from membership where uid=@uid end end end --------------Now I want to retrieve the messages disp by these Print statements in my asp.net page where i m calling this stored proc.Pls suggest RegardsMunish
View 2 Replies View RelatedI guess I just don't get the reasoning behind the new SqlDataSource control. Haven't we just spent the last decade or so evangelizing and learning how and why to separate business logic from the display in VB 6 and VS.NET? In this age of programming for disparate devices (desktop, mobile, PocketPC, etc.) when this separation makes more sense than ever, why is MS pushing us to go back to putting our logic and data access rules and objects back in the display? It doesn't make sense. Why would anyone do this? And why would all the experts and MVPs at ASP.NET, DevX, 4GuysFromRolla, etc., go along with this?
View 4 Replies View RelatedWhen running a business logic handler at the subscriber, you can override SubscriberInserts, SubscriberUpdates and SubscriberDeletes. Are these methods called when data is changed coming from the server to client, from the client to the server, or in both directions?
Thanks,
Bryan
ALTER TABLE [dbo].[bkrm_lendcoll] ADD CONSTRAINT
   ReqdCovgAmt_constraint33 CHECK   Â
( caseÂ
 when CovgAmt = 0 and  ReqdCovgAmt = 0 then 1
 when CovgAmt = 0 and  ReqdCovgAmt = 1 then 1
 when CovgAmt = 1 and  ReqdCovgAmt = 0 then 1
 when CovgAmt = 1 and  ReqdCovgAmt = 1 then 0
end =1
)
This is my first attempt to add a constraint for business logic. Â The desired behavior is that the two columns together have the same behavior as a radio button. Â (one can be true, the other true, both can be false, but both cannot be true.) I get this error when I attempt to update it.
The ALTER TABLE statement conflicted with the CHECK constraint "ReqdCovgAmt_constraint33". The conflict occurred in database "Std", table "dbo.lendcoll".
So, basically my question is, when you have two bit columns and want them to have the truth table such as described, how can I set a Check constraint to enforce this?
I have a merge replication topology that allows some subscribers (clients) to retreive a number for certain columns (ie invoice number, order number, etc).
I have implemented a custom business logic handler to check for inserts from the subscriber and before updating the server, I call a stored proc on the server to generate a new number. I update the data set and call ActionOnDataChange.AcceptCustomData. This works great for the publication db but I am trying to get this new number back into the subscription db. I am using web synchronization so I really don't have a connection back to the subscriber database.
Any Ideas? I was thinking about keeping track of the updates myself and build a sql string and somehow get that back to the subscriber to run updates for those columns... I am wondering if I am pushing the limits of the business logic handler? Was it designed to do this? Of course the easy answer is to modify my client application but I am trying to avoid that at this point.
Any help/suggestions would be greatly appreciated!
Hi,
I have 2 related tables in SQL 2005. I am using Business Logic Handler on one of those tables during Merge Replication to reject data for few rows during web synchronization. Once a row is rejected, I would like to run the Business Logic Handler for the related table to reject changes for the row with same foreign key as the rejected row in first table.
Not sure if I need to create separate Business Logic Handlers for each table or can it be achieved in a single Handler.
Also is it possible to get a list of rejected rows back from the handler?
Thanks for help.
I am currenly have a simple merge replication topology. The publisher-distibutor is SQL Server 2005 and the subscriber is a SQL Server Express. The type of subscription is non anonymous pull.
I made a custom business logic handler class that is trying the following:
When a new record is inserted in a published table on the pubsliher, some additional records are added in a differenct table in subscriber. Then the "InsertHandler" method returns "AcceptData" in order to allow the agent to add the new record in current table also.
So I am establishing a new connection to the subscriber and I am trying to add the additional recs in the different table. The problem is that this different table is also published as read-only on the subscriber. So my insert fails saying that table is not updatable.
Is there any way to bypass this problem?
In fact I realised in general that when my custom logic handler performs some DML operations on the subscriber, these are NOT considered as part of the replication e.g. the NOT FOR REPLICATION constraints and triggers are active for these operations.
Is this normal?
I have got a business logic update conflict handler working, but I have had to work round what appears to be a bug.
Please can someone confirm if this is indeed a bug €“ and if it is a known bug?
My conflict handler needs to take some columns from the publisher row and some from the subscriber row in the event of conflict.
I can quite happily generate a custom dataset which contains the winning row that I want €“ I can see that because I can step through the conflict handler with debug when a conflict occurs.
However, just returning ActionOnUpdateConflict.AcceptCustomConflictData from the UpdateConflictsHandler method does not set the publisher and subscriber columns correctly. I end up with different values on the two databases.
I have found that the only way to get the correct rows on both publisher and subscriber is to create a new ADO connection to the publisher and actually perform an update €“ updating all the modified columns. This now works reliably in my testing.
Fortunately, due to business rules the frequency of update conflicts are likely to be very infrequent, but I would very much like to avoid having to do the €˜unnecessary€™ update.
Notes:
I am using column level tracking €“ but I have seen the problem with row level tracking too
I have mainly been using SP1 but have repeated the test on a configuration using the SP2 CTP €“ and the problem occurs there too
The problem is not due to complex logic in my code. If the method just sets customDataSet = publisherDataSet.Copy and then returns ActionOnUpdateConflict.AcceptCustomConflictData, the changed and winning publisher values are not sent to the subscriber
Any thoughts would be much appreciated
What is the way we could implement a business logic from a Table bystoring it statemnnets in a colums and defining an execute sql toexecute it.Some legal requirements make it diffcult for us to createmodify stored procdures so Iwant to have a process where we create newrows in a table and execute it to execute business logic.All views are welcome.Havin g one table two tables different approaches to store ststementsand execute them....Case logic how to implement it?Flags in the tble colums in the tablesetcThanksAjay Garg
View 1 Replies View RelatedPocket PC 2003, SQL Compact Edition, SQL2005, IIS6.0
I implemented a business logic handler to deal with conflicts. When I deploy it on the SQL server which is also the web replication server, the logic handler seems working fine. However, if I deploy this handler to another web server. The logic handler failed to be loaded.
My enviroment settings are desribed as below.
Machine A, distributor, with database and publication. The business logic handler is deployed at C:Program FilesMicrosoft SQL Server90COMBusinessLogicHandler.dll. It's registered by using sp_registercustomresolver. The @assembly is specified as @assembly=C:Program FilesMicrosoft SQL Server90COMBusinessLogicHandler.dll';
Machine B, IIS server. The same business logic handler is deployed at C:Program FilesMicrosoft SQL Server90COMBusinessLogicHandler.dll on the Machine B itself.
When I ran the web replication, the Merge Agent reported the error as below.
Error loading custom assembly "C:Program FilesMicrosoft SQL Server90COMBusinessLogicHandler.dll", Error: "Could not load file or assembly 'C:\Program Files\Microsoft SQL Server\90\COM\BusinessLogicHandler.dll' or one of its dependencies. The given assembly name or codebase was invalid.
It seemed that the Merge Agent had trouble to find my logic handler because the path reported in the error log has two backward slashes. I have no idea where did that came from. I am not sure if that's the cause of the error. Without business logic handler. I had successfully finished web replication of Machine B to sync with Machine A. If I setup web replication directly on Machine A with business logic handler, I can successfully sync as well.
Does anyone has any idea about how to correctly deploy business logic handler on a web server?
Thanks,
Nigel
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,
like subject, is it possible?
bye
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
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" />
Hi,
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