Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0SQL Scripts/Queries with Calculated Values?SQL Scripts/Queries with Calculated Values?
Previous
 
Next
New Post
7/23/2007 3:10 PM
 

Hello,

Try to keep it simple.
Need ability for sql queries to be executed through various buttons I am coding.
Presently connecting to sql through .vb files and uses
{databaseOwner}{objectQualifier} as server verification.
Have found this feature easier for connecting, but more complex with executing script, because all the parameters are located on a few different files.
Because of this, it has been more confusing as the module has grown. 
Almost think simple javascript scripts would be easier, placing all script commands in one location, yet would have to refer to connection parameters, right?

Can I use javascript sql scripts/queries with .vb file?
What is best for least amount of lined coding, but simple sql updates?  java?



More importantly, using either of these methods, what is proper format for adding calculations to script or query?

EX:        if input values are being inserted to database using bind method:  <%# Bind("Score") %>
             How would I grab  <%# Bind("Score") %> + 1, or something to that effect?

Appreciate any feedback,

-Machina12

 

 
New Post
7/23/2007 7:58 PM
 

Without really understanding what you are trying to do - its a bit hard to point you in the right direction.

But for starters ... how about creating all your queries are stored procedures.
Then each button simply makes a call to the correct stored procedure. Passing any parameters required.

As for calculations in a QUERY - have a look at the AS clause :

SELECT pub_id, SUM(ytd_sales) AS total
FROM titles

The calculated column SUM(ytd_sales) will appear in column 'total' in the resulting query.

Westa

 

 
New Post
7/24/2007 2:27 PM
 

Wtatters,

Appreciate the feedback.  Havn't tested the calculation portion of the procedure yet, but it seems to make sense.
Before I bridge into calculations, I want to make sure I am using my stored procedures properly.

Within my modules .ascx view file, I am using this code to execute proper stored procedures:

<asp:ObjectDataSource ID="ObjectDataSource_InterACTION" runat="server" DataObjectTypeName="YourCompany.Modules.InterACTION.InterACTIONInfo"
DeleteMethod="InterACTION_Delete" InsertMethod="InterACTION_Insert" OldValuesParameterFormatString
="original_{0}"
OnInit="Page_Load" SelectMethod="InterACTION_SelectAll" TypeName
="YourCompany.Modules.InterACTION.InterACTIONController"
UpdateMethod
="InterACTION_Update">
<
SelectParameters
>
<
asp:Parameter DefaultValue="00" Name="ModuleId" Type="Int32"
/>
</
SelectParameters
>
</
asp:ObjectDataSource
>

Notes on above code: 

Within this section of code, I have setup commands for regular events, like insert, edit, delete, etc.
Each method then is linked to appropriate stored procedure name.


Notes on code below:
                                
Then within the GridView1, which is where information is being input, I have option within Command Field settings to show certain command buttons.
Does it automatically know when ShowDeleteButton
="True" , that ShowDelete Button will link to InterACTION_Delete, because it was dicatted above?
That would see to make sense, except, 1.) what if I want to create my own commands, non-standard, and have them appear within Command Field options as well, but linked to a custom stored procedure?


<
asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataSourceID="ObjectDataSource_InterACTION" DataKeyNames="ID,UserID,ModuleId" CellPadding="4" CellSpacing="1" EnableViewState="False" Width="650px" Font-Names="Arial" Font-Size="X-Small">
<Columns>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ItemStyle-Width=100 />

So far, this is a list of all components that intect with stored procedures and need updating when adding features:
2.) When I input my own custom command, asumming I can from question #1, within Command Field, do I need to update each of these sections below?
3.) Just want the custom command to be option within Command Field portion and run stored procedure. What is simpliest?


.ASCX File - Presentation
.ASCX.VB - Commands
Controller.VB -
System.Collections.Generic
Info.vb - declaring field attributes
SQL - stored procedures





-Machina12

 

 

 

 
New Post
7/25/2007 6:56 AM
 

you can dynamically create an SQL string, but be careful to prevent from SQL injection attacks. I suggest not to make such an user interface publically available.


Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0SQL Scripts/Queries with Calculated Values?SQL Scripts/Queries with Calculated Values?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out