Showing posts with label content. Show all posts
Showing posts with label content. Show all posts

Sunday, March 25, 2012

Additional Global fields within RS

Hi,
the usage of GLOBALS in RS is very useful because they could be used
within the definition of data sources as parameter as well as content
to fill report text fields etc.
Has anybody an idea, how to define an additional GLOBAL var and fill it
with a value' (e.g. via code extension)
Thanks for your suggestions
best regards
BruceOne way to do this is to create a parameter and leave the prompt empty... It
will not be shown with the other parameters, but it still part of the
parameters collection...
You might also try to create Statics variables in the REport Code section.
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"BB_Reporting" <Bruce.Baessler@.web.de> wrote in message
news:1107776267.070741.229380@.c13g2000cwb.googlegroups.com...
> Hi,
> the usage of GLOBALS in RS is very useful because they could be used
> within the definition of data sources as parameter as well as content
> to fill report text fields etc.
> Has anybody an idea, how to define an additional GLOBAL var and fill it
> with a value' (e.g. via code extension)
> Thanks for your suggestions
> best regards
> Bruce
>

Tuesday, March 6, 2012

Adding new content to a table by refering other tables using SQL

I keep product name, id in Table1.

I keep Category name, id in Table2.

I keep relation between product and category (product_id, category_id) in Table3.

I have added some products to the table with proper category.

Work fine

But for some products I did not specified any category

(ie their id is not present in Table3)

But now I want all such products

(ie all products whose category is nothing)

To be associated with category_id 10

Can I do this simply with SQL queries?

Hope u can help me

sujith

Hellosujith!

UPDATE [TableName] -- in your case it will be TABLE3

SET [FieldName] = 10 -- in your case it will be CATEGORY_ID

WHERE [FieldName] IS NULL -- in your case i dont know if it is NULL or ''

http://www.w3schools.com take a look at this site to learn more about SQL STATEMENT

HAVE NICE QUERY'S

|||

But I don't have any entry in table 3 if the category of a product is nothing.

I insert data into table 3 if and only if a product , belonged to acategory(this is how I save space)

|||

ohhhh...

You want to see all products that doesn't has category_Id and isnert into table 3 with category_Id = 10!

Is this that you want?

Sorry if i am not understanding your question!!

|||

sujithukvl@.gmail.com:

I keep product name, id in Table1.

I keep Category name, id in Table2.

I keep relation between product and category (product_id, category_id) in Table3.

I have added some products to the table with proper category.

Work fine

But for some products I did not specified any category

(ie their id is not present in Table3)

But now I want all such products

(ie all products whose category is nothing)

To be associated with category_id 10

Can I do this simply with SQL queries?

Hope u can help me

sujith

Following Sql statement might suite your need:

insert into product_categoryselect id ,'10'fromproductwherenot exists (select *from product_categorywhere product_category.pro_id = product.id)

Thursday, February 16, 2012

Adding Data from a form to a database

Very basic question here but I need to add a form to a page so it adds content, its as simple as that. I've done this kind of using a <asp.Formview> tag and it works, but becuase I think I've used a form view I have to click add to insert data first. Should I be using the <asp:formview> tag or is it a problem with the templates?

<asp:FormView ID="FormView1" runat="server" DataKeyNames="ContentID" DataSourceID="ObjectDataSource1">

<InsertItemTemplate>
Resource :<asp:DropDownList ID="ResourceIDTextBox" runat="server" Text='<%# Bind("ResourceID") %>' DataSourceID="ObjectDataSource2"
DataTextField="Resource" DataValueField="ResourceID">
</asp:DropDownList><br />
Headline:
<asp:TextBox ID="HeadlineTextBox" runat="server" Text='<%# Bind("Headline") %>' Width="451px"></asp:TextBox><br />
Date:
<asp:TextBox ID="DateTextBox" runat="server" Text='<%# Bind("Date") %>'>
</asp:TextBox><br />
Body:
<FTB:FreeTextBox id="FreeTextBox1" runat="Server" Text='<%# Bind("Body") %>' Width="542px" />
<br />
ImageURL:
<asp:TextBox ID="ImageURLTextBox" runat="server" Text='<%# Bind("ImageURL") %>'>
</asp:TextBox><br />
OpeningPara:
<asp:TextBox ID="OpeningParaTextBox" runat="server" Text='<%# Bind("OpeningPara") %>'>
</asp:TextBox><br />
Ret:
<asp:TextBox ID="RetTextBox" runat="server" Text='<%# Bind("Ret") %>'>
</asp:TextBox><br />
Man:
<asp:TextBox ID="ManTextBox" runat="server" Text='<%# Bind("Man") %>'>
</asp:TextBox><br />
Pro:
<asp:TextBox ID="ProTextBox" runat="server" Text='<%# Bind("Pro") %>'>
</asp:TextBox><br />
Com:
<asp:TextBox ID="ComTextBox" runat="server" Text='<%# Bind("Com") %>'>
</asp:TextBox><br />
IndustryID:
<asp:TextBox ID="IndustryIDTextBox" runat="server" Text='<%# Bind("IndustryID") %>'>
</asp:TextBox><br />
ContentTitle:
<asp:TextBox ID="ContentTitleTextBox" runat="server" Text='<%# Bind("ContentTitle") %>'>
</asp:TextBox><br />
Status:
<asp:TextBox ID="StatusTextBox" runat="server" Text='<%# Bind("Status") %>'>
</asp:TextBox><br />
Pub:
<asp:TextBox ID="PubTextBox" runat="server" Text='<%# Bind("Pub") %>'>
</asp:TextBox><br />
Fin:
<asp:TextBox ID="FinTextBox" runat="server" Text='<%# Bind("Fin") %>'>
</asp:TextBox><br />
<asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
Text="Insert">
</asp:LinkButton>
<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
Text="Cancel">
</asp:LinkButton>
</InsertItemTemplate
<ItemTemplate>

<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New"
Text="Click here to Add New Content">
</asp:LinkButton>
</ItemTemplate
</asp:FormView>


<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="Delete"
InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="ContentADDMethod"
TypeName="DataSet2TableAdapters.ContentADDAdapter" UpdateMethod="Update">

<DeleteParameters>
<asp:Parameter Name="Original_ContentID" Type="Int32" />
</DeleteParameters
<UpdateParameters>
<asp:Parameter Name="ResourceID" Type="Int32" />
<asp:Parameter Name="Headline" Type="String" />
<asp:Parameter Name="Date" Type="String" />
<asp:Parameter Name="Body" Type="String" />
<asp:Parameter Name="ImageURL" Type="String" />
<asp:Parameter Name="OpeningPara" Type="String" />
<asp:Parameter Name="Ret" Type="String" />
<asp:Parameter Name="Man" Type="String" />
<asp:Parameter Name="Pro" Type="String" />
<asp:Parameter Name="Com" Type="String" />
<asp:Parameter Name="IndustryID" Type="Int32" />
<asp:Parameter Name="ContentTitle" Type="String" />
<asp:Parameter Name="Status" Type="String" />
<asp:Parameter Name="Pub" Type="String" />
<asp:Parameter Name="Fin" Type="String" />
<asp:Parameter Name="Original_ContentID" Type="Int32" />
<asp:Parameter Name="ContentID" Type="Int32" />
</UpdateParameters
<InsertParameters>
<asp:Parameter Name="ResourceID" Type="Int32" />
<asp:Parameter Name="Headline" Type="String" />
<asp:Parameter Name="Date" Type="String" />
<asp:Parameter Name="Body" Type="String" />
<asp:Parameter Name="ImageURL" Type="String" />
<asp:Parameter Name="OpeningPara" Type="String" />
<asp:Parameter Name="Ret" Type="String" />
<asp:Parameter Name="Man" Type="String" />
<asp:Parameter Name="Pro" Type="String" />
<asp:Parameter Name="Com" Type="String" />
<asp:Parameter Name="IndustryID" Type="Int32" />
<asp:Parameter Name="ContentTitle" Type="String" />
<asp:Parameter Name="Status" Type="String" />
<asp:Parameter Name="Pub" Type="String" />
<asp:Parameter Name="Fin" Type="String" />
</InsertParameters
</asp:ObjectDataSource>


<asp:ObjectDataSource ID="ObjectDataSource2" runat="server" InsertMethod="Insert"
OldValuesParameterFormatString="original_{0}" SelectMethod="GetData" TypeName="DataSet2TableAdapters.ResourcesTableAdapter">
<InsertParameters>
<asp:Parameter Name="Resource" Type="String" />
</InsertParameters>
</asp:ObjectDataSource>

I'm sorry, but what is your complaint? You have to click an add button in order to add a new record?