Wednesday, March 21, 2012
Detect Existing Subscription on Subscriber
Is there a way to check the subscriber if a particular subscription exists
using SQLDMO ActiveX control? If not, how would it be done through stored
procedure?
Thanks,
Tom
Tom,
on the subscriber you could run sp_helppullsubscription or just query the
MSreplication_subscriptions table - I think this is the easiest method.
Using SQLDMO there is a TransPullSubscriptions collection that could be
iterated, although I'm not too sure if this works on the subscriber.
HTH,
Paul Ibison SQL Server MVP, www.replicationanswers.com
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
Monday, March 19, 2012
DetailsView Control (Please Help!)
Can someone please tell me what I am doing wrong...
I have a simple webform that has contains a GridView and a DetailsView. Once the GridView is populated the user simply selects a record from the list. The DetailsView is them populated with all of the data from the selected record.
The DetailsView is bound to a SQL DataSource/CustomerData. I have made sure that the DV control has the Edit/Update Command listed. The user can click the Edit button and successfully edit the fields but when the user clicks the "Update" button I am getting the following message.
Updating is not supported by data source 'CustomerData' unless UpdateCommand is specified
Why isnt the control handling the Update.
Many Thanks!!!!
T
You still need to have your SqlDataSource for the detailview configured to handle the editing...
This sample is doing the same tihng as you described. Chaeck your code against it to see what is the difference.
http://www.asp.net/QuickStart/util/srcview.aspx?path=~/aspnet/samples/data/GridViewMasterDetailsInsert.src
If you still have question, please post back here.
|||Limno,
First thank you for responding... I did do some more research after posting and found that I was not calling the Update Command. I subsequently have added that... I am not getting any errors but... Its not updating the database. I looked at the link you supplied and it appears that I have everything setup correctly... Obviously not!!!!
Any guidance would be much appreciated.
Here is my code:
<asp:DetailsViewID="DVCustomerInfo"runat="server"Height="22px"Width="215px"CellPadding="4"Font-Size="0.65em"ForeColor="#333333"GridLines="None"HeaderText="Customer Info."AllowPaging="True"AutoGenerateRows="False"DataKeyNames="WorkSheetID,Origin,DealerName,DateCreated,SalesRep,BkupSalesRep,FirstName,MiddleName,LastName,Address,City,State,Zip,HomePhone,WorkPhone,CellPhone,Email,County,SalesTax,SS,DOB"DataSourceID="ApplicantSQLDS">
<FooterStyleBackColor="#1C5E55"Font-Bold="True"ForeColor="White"/><CommandRowStyleBackColor="#C5BBAF"Font-Bold="True"/><EditRowStyleBackColor="#7C6F57"/><RowStyleBackColor="#E3EAEB"/><PagerStyleBackColor="#666666"ForeColor="White"HorizontalAlign="Center"/><FieldHeaderStyleBackColor="#D0D0D0"Font-Bold="True"/><HeaderStyleBackColor="Black"Font-Bold="True"ForeColor="White"/><AlternatingRowStyleBackColor="White"/><Fields><asp:BoundFieldDataField="WorkSheetID"HeaderText="WorkSheetID"ReadOnly="True"SortExpression="WorkSheetID"/><asp:BoundFieldDataField="Origin"HeaderText="Origin"ReadOnly="True"SortExpression="Origin"/><asp:BoundFieldDataField="DealerName"HeaderText="DealerName"ReadOnly="True"SortExpression="DealerName"/><asp:BoundFieldDataField="DateCreated"HeaderText="DateCreated"ReadOnly="True"SortExpression="DateCreated"/><asp:BoundFieldDataField="SalesRep"HeaderText="SalesRep"ReadOnly="True"SortExpression="SalesRep"/><asp:BoundFieldDataField="BkupSalesRep"HeaderText="BkupSalesRep"SortExpression="BkupSalesRep"/><asp:BoundFieldDataField="FirstName"HeaderText="FirstName"ReadOnly="True"SortExpression="FirstName"/><asp:BoundFieldDataField="MiddleName"HeaderText="MiddleName"ReadOnly="True"SortExpression="MiddleName"/><asp:BoundFieldDataField="LastName"HeaderText="LastName"ReadOnly="True"SortExpression="LastName"/><asp:BoundFieldDataField="Address"HeaderText="Address"SortExpression="Address"/><asp:BoundFieldDataField="City"HeaderText="City"SortExpression="City"/><asp:BoundFieldDataField="State"HeaderText="State"SortExpression="State"/><asp:BoundFieldDataField="Zip"HeaderText="Zip"SortExpression="Zip"/><asp:BoundFieldDataField="HomePhone"HeaderText="HomePhone"SortExpression="HomePhone"/><asp:BoundFieldDataField="WorkPhone"HeaderText="WorkPhone"SortExpression="WorkPhone"/><asp:BoundFieldDataField="CellPhone"HeaderText="CellPhone"SortExpression="CellPhone"/><asp:BoundFieldDataField="Email"HeaderText="Email"SortExpression="Email"/><asp:BoundFieldDataField="County"HeaderText="County"SortExpression="County"/><asp:BoundFieldDataField="SalesTax"HeaderText="SalesTax"SortExpression="SalesTax"/><asp:BoundFieldDataField="SS"HeaderText="SS"SortExpression="SS"/><asp:BoundFieldDataField="DOB"HeaderText="DOB"SortExpression="DOB"/><asp:CommandFieldButtonType="Button"CausesValidation="False"ShowEditButton="True"/></Fields></asp:DetailsView><asp:SqlDataSourceID="ApplicantSQLDS"runat="server"ConnectionString="<%$ ConnectionStrings:CustomerInfoConnection %>"SelectCommand="SELECT [WorkSheetID], [Origin], [DealerName], [DateCreated], [SalesRep], [BkupSalesRep], [FirstName], [MiddleName], [LastName], [Address], [City], [State], [Zip], [HomePhone], [WorkPhone], [CellPhone],|||
Hi:
Is theWorkSheetID column your primary key in your database table? You need primary key to do update.
You may not need put all columns inDataKeyNames. If WorkSheetID is the primary key of the table, you can set
DataKeyNames="WorkSheetID".
|||
I found the problem...I must say its always interesting to learn soemthing new...
Anyway... I found that I had my DataKeyNames set incorrectly... I had it set to all of the fields rather then the 1 primary key WorksheetID.
I am successfully updating... Many thanks again for replying.
T
detailsview control - how to edit record in Sql Server Express
I have null values in some of the fields & when I use EDIT to make changes these changes are not recorded + I receive no error.
Check the condition in the update statement. If it is correct..pls provide the complete code...so that we can give you some suggestion accordingly
Detailed View in C#
I was wondering if there is a detailed view control (that can be linked to grid view control) in ordinary C# applications as we have in ASP.NET applications? Please if anyone has information regarding that let me know.
RegardsAny information? It seems that we cannot do that in C# applications.
Regards
Detailed View in C#
I was wondering if there is a detailed view control (that can be linked to grid view control) in ordinary C# applications as we have in ASP.NET applications? Please if anyone has information regarding that let me know.
RegardsAny information? It seems that we cannot do that in C# applications.
Regards
Sunday, February 19, 2012
Design Question
I am trying to implement a invtentory control system and would like
some advice on the best design for it.
The system will have to main tables Product and Stock which will look
as follows
Product
---
ProductId
PartNumber
Description
Stock
--
StockId
ProductId
SerialNumber
RecievedDate
OrderNo
ShipmentNo
In ths stock table the RecivedDate Signifies when the product
recieved, The OrderNo signifies the whether the item has been sold and
the shipmentNo represents whethert tiem has been shipped.
I want to produce an SQL query which basically looks like this
StockList
---
PartNumber
Description
QtyInStock (StockItems not sold or shipped)
QtySold (StockItems Sold)
QtyShipped (StockItems Sold and shipped)
I cant seem to work out what the query would look like for this.
Has anyone got anytips, or alternative ideas/designs"Boogieboy" <iamthecow@.hotmail.com> wrote in message news:67ae4f66.0409220519.6d99eb62@.posting.google.c om...
> Hi
> I am trying to implement a invtentory control system and would like
> some advice on the best design for it.
<snip>
> I want to produce an SQL query which basically looks like this
> StockList
> ---
> PartNumber
> Description
> QtyInStock (StockItems not sold or shipped)
> QtySold (StockItems Sold)
> QtyShipped (StockItems Sold and shipped)
> I cant seem to work out what the query would look like for this.
> Has anyone got anytips, or alternative ideas/designs
Tip: Summing 1s and 0s is essentially the same as counting...
How about this?
Select
PartNumber,
Description,
SUM( CASE
WHEN OrderNo is NULL and ShipmentNo is NULL
then 1 else 0 END) as QtyInStock,
SUM( CASE
WHEN OrderNo is NOT NULL and ShipmentNo is NULL
then 1 else 0 END) as QtySold,
SUM( CASE
WHEN OrderNo is NOT NULL and ShipmentNo is NOT NULL
then 1 else 0 end) as QtyShipped
FROM
Product
JOIN Stock
ON Product.ProductID = Stock.ProductID
GROUP BY
PartNumber,
Description
ORDER BY
PartNumber ;
--
Paul Horan[TeamSybase] www.teamsybase.com
Sr. Architect
VCI Springfield, Mass
www.vcisolutions.com|||>> Has anyone got any tips, or alternative ideas/designs <<
inventory, orders and shipments are all logically different things, I
would put them in separate tables.