Passing Data To SQL Database

Apr 8, 2007

hello everybody,
    i hope u can help me with this... i want to pass the data entered in a web page to a stored procedure  so as to store the data in a database... am using three layered architecture... how can i do this....
  thanks in advance.............
 

View 1 Replies


ADVERTISEMENT

Passing Data Between Multiple Data Flows

Nov 1, 2005

OK, it's the first of the month...that must mean it's time for another dumb question!

View 10 Replies View Related

Passing The Same Data To Every SP

Jan 17, 2008



Hi,

I have a slight problem. I would like to pass some form of out of band data to every SP when called using ADO.NET.

A little more info is needed I think. I need to pass a unique identifier to ever SP my application calls and have that identifier available to use by the SP.

As my application has many many SP's in use I am trying to avoid adding an extra parameter to each and every one. I was really hoping for the ADO command object to have a property I could use to pass 'user defined' data to the database engine.

For example:

My SP's write to an audit trail table. The audit trail needs to record the user that executed the SP, this user might not be the same user that logged on to the database (depends on the connection string really). So, instead of adding an extra param to each SP, I want to access some data from the ADO command that was used to call the SP.

Can anyone help, or have I just confused everyone?

Graham

View 4 Replies View Related

Passing Value To A Variable From Database

Apr 25, 2008

I am trying to get data from a database through a select statment and I want to pass the return query to a c# string variable. Any idea how can I do this?
 

View 2 Replies View Related

Sub Report Passing Data Up

Feb 25, 2008

Hi

Can anyone help with this. Is it possible to pass data from a sub-report to the main report. I know this was possible in Crystal.

I currently have VS2005 but may be able to justify a move to 2008 if it can do it.

Thanks

View 10 Replies View Related

Passing Values From Database To Variables.

Nov 12, 2007

Hello.
I need to store 2 values that i retrive from a databse into variables so i can check them towards what is typed into the textboxes for my login script iv built. How can i do this?1 string myConnectionString = @"Data Source=.SQLEXPRESS;AttachDbFilename=C:UsersalhoDocumentsIntrapointWebApp_DataIntrapoint.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True";
2
3 SqlConnection myConnection = new SqlConnection(myConnectionString);
4 SqlCommand cmd = new SqlCommand("SELECT [username], [password] FROM [company] WHERE (([username] = @username) AND ([password] = @password))");
5 cmd.Parameters.AddWithValue("username", TextBoxUsername.Text);
6 cmd.Parameters.AddWithValue("password", TextBoxPassword.Text);
7
8 myConnection.Open();
9
10 //how do i pass the values retrived into variables, like string usrname and string password?
11
12 myConnection.Close();
 

View 13 Replies View Related

Passing Null Date Value To Database

Oct 31, 2004

how can i pass null value to database? date is not required field in my database. i can pass default date but i think default date is not good in my case as it is DOB of a customer.

View 19 Replies View Related

Passing A Date Name To A Database Back Up

Oct 10, 2000

I am trying to pass a datename in to a database backup. The date is to be retrieved from the 'monthname' column which is stored in the 'tblbill' table. I have included my ridiculous bit of code below (which funnily enough does not work!!) just so that you can see what I am trying to do. Can anyone help?

DECLARE @name varchar(10)
backup database Bill to Disk ='c:@name.dat' with init

@name =select distinct monthname from tblbill where monthname is not null

cheers,
Dennis

View 2 Replies View Related

Passing Database Name To A Stored Procedure

Jul 28, 2004

Hi all,
I want to use a stored procedure to access data in different databases. I was wondering if it is possible to pass the database name to the stored procedure as a parameter and use it in the sql statement.
Thank you for all the help you can give me.
Regards,
Eve

View 3 Replies View Related

Passing Constants In Data Flows

Jan 13, 2006

Hi

Does anyone know what would be the best technique to use for passing constants into data flows shapes?

For example if I had a lookup that required a static value to be passed into it as part of a concatenated key etc...

Cheers

Al

View 1 Replies View Related

Passing Data From Db To Ssis Variable

Jul 11, 2007

Is there anyway to pass data from a sql database to a variable in a ssis package. I'm trying to get a few fields from a sql database into some variables in my package and send an email using these variables with the send mail task?



Thanks,

View 17 Replies View Related

Form Passing NULL To Database Instead Of Variable

Apr 12, 2007

Not sure what i'm doing wrong here. it seems to be sending nulls or no value to database in places where i want it to send the @headline and @entryhere's the .aspx code: <%@ Page Language="c#"     MasterPageFile="~/MasterPage.master"     AutoEventWireup="true"     CodeFile="NewPost.aspx.cs"     Inherits="NewPost"     Title="Scribbler Insert" %>       <asp:Content ID="PageBody" runat="server"    ContentPlaceHolderID="PageBody" ><table border="0" width="700" >  <tr>    <td width="80" valign="top">      Subject:    </td>    <td width="620" valign="top">      <asp:TextBox ID="txtHeadline" runat="server"           Width="400px"/>      <asp:RequiredFieldValidator runat="server"        ID="RequiredFieldValidator1"        ControlToValidate="txtHeadline"        ErrorMessage="Headline is required"         Display="Dynamic" />    </td>  </tr>  <tr>    <td width="80" valign="top">      Text:    </td>    <td width="620" valign="top">      <asp:TextBox ID="txtEntryText" runat="server"           TextMode="MultiLine"          Height="250px"          Width="400px" />      <asp:RequiredFieldValidator runat="server"        ID="RequiredFieldValidator2"        ControlToValidate="txtEntryText"        ErrorMessage="Text is required"         Display="Dynamic" />    </td>  </tr></table><asp:Button ID="btnPost" runat="server"     Text="Post" OnClick="btnPost_Click" /><asp:Button ID="btnCancel" runat="server"     PostBackUrl="~/Admin/Admin.aspx"     Text="Cancel" />   <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:scribblerdbConnectionString %>"            ProviderName="<%$ ConnectionStrings:scribblerdbConnectionString.ProviderName %>"    InsertCommand="INSERT INTO entries_tbl (Headline, entry, PostedBy, PostedDate, PostedTime) VALUES (@Headline, @Entry, 'SteveP', '2007-12-12', '12:44');" >         <InsertParameters>            <asp:ControlParameter Name="Headline"                ControlID="txtHeadline"                PropertyName="Text"                Type="String" />            <asp:ControlParameter Name="entry"                ControlID="txtEntryText"                PropertyName="Text"                Type="String" />             </InsertParameters></asp:SqlDataSource></asp:Content> 

View 2 Replies View Related

Passing In Current Database Name To DTS-based SQL Task?

Sep 28, 2006

Hi all--I am writing a DTS package looking to back up all databases in sequence. I am calling CDOSYS in a stored procedure from support.microsoft.com to send email upon failure. I have two types of tasks I am writing into the DTS package:

1. backup database <database> to disk = '<drive>:<path>.bak' with init

2. Upon failure, send the following message:

declare @srvname varchar(128),
@db_name varchar(128),
@msg nvarchar(4000)

select @srvname=srvname from master.dbo.sysservers
print @srvname
select @db_name=name from master.dbo.sysdatabases
print @db_name
set @msg='Hi--check your database backups. The ' + @db_name + ' database backup on ' + @srvname + ' has failed.

Thanks--SQL Server';

Upon success, go to the next database to back up, execute through these steps for the next database. Here's my problem: The @db_name variable captures the proper value for the current SQL Server, but I want to turn both @srvname and @db_name into global variables. I would like to pass in @db_name as the current database being backed up (and failing), and @srvname as the current SQL Server instance being backed up.

The above statement "select @db_name=name from master.dbo.sysdatabases" definitely does not capture the current database name value. Any suggestions as to how to pass this in, if not as a global variable?

Thanks in advance,

Jonathan

View 2 Replies View Related

Passing Variables To Data Flow Component

Apr 27, 2006

Hi,

I've read the various posts and articles regarding this matter, but I seem to have problems getting to work:

In my control flow, I start by declaring a variable named "LastJobLedgerEntryID", to identify the records I need to add to the stage. From there I would like to use this variable in the source component in my dataflow, i.e.:

"SELECT [Entry No_],[Job No_],[Posting Date],[Document No_],[Type],[No_],[Description],[Quantity],[Direct Unit Cost],[Unit Cost],[Unit Price],[Chargeable],[Job Posting Group],[Global Dimension 1 Code],[Global Dimension 2 Code],[Work Type Code] FROM mytable WHERE [Entry No_] > " + @[User::LastJobLedgerEntryID]

But this fails? I should note that the variable LastJobLedgerEntryID is stored as a int32, and with the default value of 0

Could someone please help me with this?

Thanks in advance!

View 5 Replies View Related

Where Clause Problem When Passing In Data Dynamicly - HELP!

Apr 9, 2008

I have a stored proc that I am trying to use for sorting and paging below is a portion of it. When I hard code "Stan" into the Where clause I get all the records back that where posted by "Stan" but when I try to pass in "Stan" as a variable it tells me something about an invalid column name.

Here is the working version. When I hard code "Stan" into the Where Clause it works. I am using 2 single quotes on each side. See Where clause.

SET @sql ='SELECT [ThreadName],[PostID],[PostTypeID],[LanguageID],[PostAccessID],[UserID],[ThreadID],[PostParentID],[VoteSummaryID],

[Subject],[Body],[PostAuthor],[PostDate],[IsApproved],[TotalViews],[FormattedBody],[IPAddress],[PostCount],[ArticleCount],

[TrackbackCount],[IsSticky],[StickyDate]

FROM

(SELECT t.[ThreadName], p.[PostID],p.[PostTypeID],p.[LanguageID],p.[PostAccessID],p.[UserID],p.[ThreadID],p.[PostParentID],p.[VoteSummaryID],

p.[Subject],p.[Body],p.[PostAuthor],p.[PostDate],p.[IsApproved],p.[TotalViews],p.[FormattedBody],p.[IPAddress],p.[PostCount],p.[ArticleCount],

p.[TrackbackCount],p.[IsSticky],p.[StickyDate],ROW_NUMBER() OVER(ORDER BY ' + @sortExpression + ') as RowNum

FROM syl_Posts p

INNER JOIN syl_Threads t ON t.[ThreadID] = p.[ThreadID]

WHERE t.[PostAuthor] = ''Stan'')



AS syl_TPInfo

WHERE RowNum BETWEEN ' + CONVERT(nvarchar(10), @startRowIndex) +

' AND (' + CONVERT(nvarchar(10), @startRowIndex) + ' + '

+ CONVERT(nvarchar(10), @maximumRows) + ') - 1'


Not working when I try to pass in a variable into the Where clause.

SET @sql ='SELECT [ThreadName],[PostID],[PostTypeID],[LanguageID],[PostAccessID],[UserID],[ThreadID],[PostParentID],[VoteSummaryID],

[Subject],[Body],[PostAuthor],[PostDate],[IsApproved],[TotalViews],[FormattedBody],[IPAddress],[PostCount],[ArticleCount],

[TrackbackCount],[IsSticky],[StickyDate]

FROM

(SELECT t.[ThreadName], p.[PostID],p.[PostTypeID],p.[LanguageID],p.[PostAccessID],p.[UserID],p.[ThreadID],p.[PostParentID],p.[VoteSummaryID],

p.[Subject],p.[Body],p.[PostAuthor],p.[PostDate],p.[IsApproved],p.[TotalViews],p.[FormattedBody],p.[IPAddress],p.[PostCount],p.[ArticleCount],

p.[TrackbackCount],p.[IsSticky],p.[StickyDate],ROW_NUMBER() OVER(ORDER BY ' + @sortExpression + ') as RowNum

FROM syl_Posts p

INNER JOIN syl_Threads t ON t.[ThreadID] = p.[ThreadID]

WHERE t.[PostAuthor] = ' + @PostAuthor + ')



AS syl_TPInfo

WHERE RowNum BETWEEN ' + CONVERT(nvarchar(10), @startRowIndex) +

' AND (' + CONVERT(nvarchar(10), @startRowIndex) + ' + '

+ CONVERT(nvarchar(10), @maximumRows) + ') - 1'

View 21 Replies View Related

Need Help On How To Passing Variable Inside A Data Flow

Jun 19, 2006


All,

Is it possible to passing variable at row level within a data flow? If so, what transformation should use?

Thanks

View 6 Replies View Related

Passing Data From Subreport To Main Report

Sep 21, 2007

I need to convert a Crystal report that contains three subreports. Each of these subreports uses a different stored procedure to obtain data. The main report uses data from these subreports to calculate averages in the footer etc.

How do i get the data contained in these subreports so i can use it in my main report??
Thanks in advance

View 4 Replies View Related

Passing Variables To Data Reader Source

May 22, 2007

I am running a sql task which will pass table as object variable to the result set

I have a for each loop container which is used to loop for all the servers. I use two of the parameters to establish connection string in the for each loop task from the reasult set variables.



Now my next step is a data flow task (Data Reader Source) where i have to run a query but the table name and column names are dynamic and i dont see an option to call variables.

can someone tell me if this is possible (var1,var2,... are variables in the package scope)



select var1, var2 from var3.var4

where var5 = 'y'

View 9 Replies View Related

Data Type Of Parameter Passing To A Stored Procedure

Feb 25, 2004

Hi,
I pass a paramter of text data type in sql server (which crosspnds Memo data type n Access) to a stored procedure but the problem is that I do not know the crossponding DataTypeEnum to Text data type in SQL Server.

The exact error message that occurs is:

ADODB.Parameters (0x800A0E7C)
Parameter object is improperly defined. Inconsistent or incomplete information was provided.

The error occurs in the following code line:
.parameters.Append cmd.CreateParameter ("@EMedical", advarwchar, adParamInput)

I need to know what to write instead of advarwchar?
Thanks in advance

View 1 Replies View Related

Passing Multi-Value Parameters To A Data Driven Subscription

Apr 24, 2007

Hi,



I've been asked to set up a data driven subscription for a number of reports which use multi value parameters. For example, show me all transactions against the following departments: IT, Building Services, Accounts.



As an interactive report it's simple, the user just selects the relevant departments, but as a data driven subscription I can't seem to find the correct format to pass the selections through.



Has anyone tried this before?



Thanks,



Dan

View 1 Replies View Related

Passing Null Value Parameter To A Data-driven Subscription

Jun 13, 2007

I have a data-driven subscription (DDS) stored procedure that gets called when a subscription fires and returns parameters to a report. One of the parameter values I want to return is NULL, which also happens to be the default value of the corresponding report parameter.



When I set the report parameter to use the default value (NULL) when setting up the subscription in Report Manager, the subscription works fine. When I try to pass the NULL value from the DDS proc to the report, the subscription fails.



I do not know what the error logs say. I've rarely looked at them and what I have seen seems a bit cryptic. I've narrowed down through trial-and-error that passing the NULL value is the issue.



Has anyone else experienced this issue and do you have a resolution?



Thanks in advance for your assistance.

View 5 Replies View Related

Passing Parameters To DataSet Useb As Report Data Source

May 21, 2007

Hi guys,



How can I pass a parameter used for the DataSet query? I'm using this DataSet file as data source of my .rdlc report for Windows Forms.



I've already done a .rdlc report to Web Forms where I passed the query parameter by ObjectDataSource.SelectParameters, but in Windows Forms this object was not created. I just hava the following created objects:

- despesaTableAdapter (from myDataSetTableAdapter)

- despesaBindingSource (Windows.Forms.BindingSource)

- RelatorioDataSet (from myDataSet)

- relatorioDataSet1 (from myDataSet)



Any help will be very appreciated.







Tks and rgds,

Luis Antonio

View 1 Replies View Related

Reporting Services Data Extension - Passing Report Parameters

Jul 24, 2007

I have created a custom data extension.



I am using this custom data extension from BI Studio.



Que1: I want to create report parameters from BI studio and capture them in my Data Extension.



Que2: Every report parameter has so many properties, like hidden, internal, default value etc, how do capture that information in my data extension, the parameters only give me name and value.



Que3: I know I can capture command Text. So My command can be Select * From tablename where fieldname= @myFieldname. Once I get this commandText in my data extension, How do extract parameters of the command?



Que4: If I have any custom attributes in my RDL file, Can I capture them in my Data Extension ?



Any help is appreciated...













View 1 Replies View Related

Transact SQL :: Passing Multi-valued Data As Single Parameter In Query

Jul 2, 2015

I have a sp where query is as below.

DECLARE @ServerCIName varchar(5000)
SELECT * FROM  dbo.INC
WHERE Status in ('Assigned','In Progress','Pending')
and Description like '%' + (Select * from SplitDelimiterString(@ServerName,',')) + '%'
and (select DATEADD(dd, DATEDIFF(dd, 0, (Submit_Date)), 0)) = (select DATEADD(dd, DATEDIFF(dd, 0, getdate()), 0))
In place of "and Description like '%' + (Select * from SplitDelimiterString(@ServerName,',')) + '%' ", if I use "and Description like '%' + @ServerName + '%' " and pass a single value, it works.

But @ServerName contains multiple values and it is dynamic (not constant).

How do I query the data?

View 6 Replies View Related

Reporting Services :: Passing Parameters To SSRS That Is Using Web Service As Data Source

Jul 16, 2009

I am building a webapp that calls an SSRS instance to display a report based on another servers web service.I can make a call from the ssrs server using this in the RDL:

<Query>
<Method Namespace="http://machine/webservices" Name="HelloUser">
                <Parameters>
                                <Parameter Name="user">
                                <DefaultValue>Craig</DefaultValue>
                                </Parameter>
                </Parameters>
</Method>
<ElementPath IgnoreNamespaces="true">*</ElementPath>
</Query>

This works no problem.  but.. I want to have the user parameter "Craig" be a parameter passed in from the web app.  If it were a regular SQL data source you would put @user in the query.  How do you do it with XML text queries?

View 5 Replies View Related

Reporting Services :: Passing Report Parameters To A Query Using WCF Data Source?

Nov 29, 2010

I am attempting to pass report parameters to my query. My report's data source is a WCF web service. I can run normal queries fine, but I have found that without the know-how to pass parameters to my query I am limited with my capabilities.

Assume a string parameter named "Name" with a specified default value of "Jmachol90", how would I pass that into the following query at the designated place:
  
<Query>
          <Method Namespace="http://schemas.microsoft.com/sqlserver/masterdataservices/2009/09" Name="SecurityPrincipalsGetRequest">
          <Parameters>
          <Parameter Name="Criteria" Type="XML">
<DefaultValue>

[code]....

View 17 Replies View Related

SQL 2012 :: SSIS Passing Parameters To Stored Procedure That Changes Based On The Data Being Passed?

Jun 23, 2015

Using the following:

SQL Server: SQL Server 2012
Visual Studio 2012

I have created an SSIS package where I have added an Execute SQL Task to run an existing stored procedure in my SQL database.

General Tab:

Result Set: None
Connection Type: OLE DB
SourceType: Direct Input
IsQueryStoredProcedure: False (this is greyed out and cannot be changed)
Bypass Prepare: True
SQL Statement: EXEC FL_CUSTOM_sp_ml_location_load ?, ?;

Parameter Mapping:

Variable Name Direction Data Type Prmtr Name Prmtr Size
User: system_cd Input NVARCHAR 0 10
User: location_type_cd Input NVARCHAR 1 10

Variables:

location_type_cd - Data type - string; Value - Store (this is static)
system_cd - Data type - string - ??????
The system code changes based on the system field for each record in the load table

Sample Data:

SysStr # Str_Nm
3 7421Store1
3 7454Store2
1815061Store3
1815063Store4
1615064Store5
1615065Store6
1615066Store7
7725155Store8

STORED PROCEDURE: The stored procedure takes data from a load table and inserts it into another table:

Stored procedure variables:
ALTER PROCEDURE [dbo].[sp_ml_location_load]
(@system_cd nvarchar(10), @location_type_cd nvarchar(10))
AS
BEGIN .....................

This is an example of what I want to accomplish: I need to be able to group all system 3 records, then pass 3 as the parameter for system_cd, run the stored procedure for those records, then group all system 18 records, then pass 18 as the parameter for system_cd, run the stored procedure for those records and keep doing this for each different system in the table until all records are processed.

I am not sure how or if it can be done to pass the system parameter to the stored procedure based on the system # in the sys field of the data.

View 6 Replies View Related

String Or Binary Data Would Be Truncated // Is There A Maximum Length For Passing An Nvarchar Max To A Function?

Mar 18, 2008

I'm running into this error message when passing in a few records in particular to a function, the only difference I could find is that these recods have about 60k characters on the field that I'm passing to a function.

is there a max lenght for passing to a function?

select function ( field) as results

It's been working fine until today and all of the related fields are declared as nvarchar(max)

Thank you.

View 5 Replies View Related

T-SQL (SS2K8) :: Passing Parameters On Query - Error Converting Data Type Varchar To Numeric

Sep 1, 2014

I have the following code and i want to passed more than one value:

DECLARE @myvendedor AS varchar(255)
SET @myvendedor = '87,30'
print @myvendedor
SELECT top 10 ECOM.COM1,* from ecom (nolock) WHERE ecom.PORVEND=1 AND ECOM.VENDEDOR IN (@myvendedor)
Table Field ECOM.VENDEDOR is Numeric(4,0)

This error occur:

87,30 --Result of PRINT

Msg 8114, Level 16, State 5, Line 6
Error converting data type varchar to numeric.

I change :

DECLARE @myvendedor AS numeric(4,0)

and this error appear:

Msg 8114, Level 16, State 5, Line 2
Error converting data type varchar to numeric.

View 9 Replies View Related

Database Create ODBC Connections To Access Database Directly And Update Data?

Sep 10, 2012

We have a SQL database that uses Active Directory with Windows Authentication. Can users that are members of the Active Directory group that has read/write access to the SQL database create ODBC connections to access the database directly and update the data? They dont have individual logins on the server. They are only members of the Active Directory group that has a login?

View 1 Replies View Related

How To Change The Data Format For A Single Database In A SQL Server Group Of Database

Nov 1, 2001

Hi all,

I have to change the date format for one database in a group of databases in my sql server 2000,Can you please tell me how to change the date format.


thanks in advance

View 1 Replies View Related

Taking Data From A Different Databases/Data Warehouses Using A Sequel Server 2005 Based Database.

Apr 1, 2008



I'm in the middle of developing a Database for a hospital that measures its audits, inhouse operations, and finance. What we currently have and do everyday is collect data from a large database that is real time with patient data, progess, infomation, etc and dump it into a data warehouse that runs on TSI/Eclipsys. We run reports using a number of programs and dump it into Excel sheets that have charts, reports, etc. This Database for which I'm developing won't come soley from the TSI/Eclypsys source, but this is the only source thats updated regularly. I don't want to have in sync with TSI/Eclipysys in fear that every day when it updates data may be lost, not read, or worse won't be up date if there is a problem. My question is is it possible to run a query from Sequel Server 2005 that will take that data upon request using the reporing features on Sequel Server 2005. i.e. What if I need to run a report on measure B in department 12 from Jan 1-Feb 1, instead of being in sync, can I just write queries to take that information rather than double the data and take up twice the space and trouble. FYI, these datatypes rarely change in the TSI/Eclipsys data warehouse. This sure was long question and didn't intended it to be . Thanks for listening and hope to hear back.


Stephen

View 1 Replies View Related

SQL Security :: Making Data Change In Read Only Database Without Letting Other Users Update Data

Aug 6, 2015

I want to make data changes in read_only database , that's why i must set database read_write. While database is at read_write mode, i want to be sure that no one makes change in database.

For this aim, i write the code below, but i suspect that after setting the database read_write, till the setting database
single_user ,is it possible get DML script from another user. Is the code below enough for this operation. Or is there another way?

Reminding: Read_only database can not be set single_user mode. That's why, first you must set database read_write.

The code;

use master
alter database xxx set read_write
with rollback immediate
alter database xxx set single_user
with rollback immediate

use xxx
update  tablexxx set columnxxx=yyy
use master
alter database xxx set read_only
with rollback immediate
alter database xxx set multi_user
with rollback immediate

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved