Populate Automactly UpdateParameters

Jan 29, 2008

 Hi there!
I'm trying to populate automactly a record in a table. I've tried this:
   <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ProducaoLigacao %>" SelectCommand="UPDATE [Producao] SET [Prodas] = @Prodas WHERE ([ProdUserID] = @ProdUserID)">
<UpdateParameters>
<asp:Parameter DefaultValue="1" Name="ProdUserID" Type="Int32" />
<asp:Parameter DefaultValue="999" Name="Prodas" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
 Is this possible? 
Thanks in advance! 

View 5 Replies


ADVERTISEMENT

UpdateParameters?

Apr 17, 2007

Hello everyone,
 
I have a templatefield dropdownlist in a gridview. i'm trying to make the dropdownlist the controlID in updateparameters tag. But I get the following error when trying to update the datasource Thank you!. "Could not find control 'DropDownList3' in ControlParameter"
<asp:TemplateField HeaderText="IT Member" SortExpression="txtenteredby">
<EditItemTemplate>
<asp:DropDownList ID="DropDownList3" runat="server" DataSourceID="ObjectDataSource1"
DataTextField="txtUserName">
</asp:DropDownList>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("txtenteredby") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:SqlDataSource
id="CustomersSqlDataSource"
runat="server"
ConnectionString="<%$ ConnectionStrings:SPIdb %>"
 
 
UpdateCommand="UPDATE table SET txtBName=@txtBName,txtPType=@txtType,txtBrand=@txtBrand,txtCondition=@txtCondition,txtstatus=@txtstatus,txtenteredby=@txtenteredby,txtDescription=@txtDescription where intID=@intID"
<UpdateParameters>
<asp:ControlParameter Name="txtenteredby" ControlId="DropDownList3" PropertyName="SelectedValue"/>
</UpdateParameters>
</asp:SqlDataSource>
 
 

View 6 Replies View Related

Specifying Updateparameters In Gridview

Jun 7, 2006

Where exactly are the updateparameters of a gridview picked up from?  I have created 2 very similar gridviews and given the updateparameters the same names as in my edititemtemplates.  Yet this method has worked for 1 gridview and failed for the second gridview.  Here is my gridview :
 <asp:SqlDataSource ID="SqlDataSource1" runat="server"                ConnectionString="<%$ ConnectionStrings:XConnectionString %>"               SelectCommand="ViewForecast" SelectCommandType="StoredProcedure"               DeleteCommand="DeleteForecast" DeleteCommandType="StoredProcedure"               UpdateCommand="UpdateForecast" UpdateCommandType="StoredProcedure">                   <DeleteParameters>                       <asp:Parameter Name="ForecastKey" Type="Int32" />                   </DeleteParameters>                   <UpdateParameters>                       <asp:Parameter Name="ForecastKey" Type="Int32" />                       <asp:Parameter Name="CompanyKey" Type="Int64" />                       <asp:Parameter Name="ForecastType" Type="Char" />                       <asp:Parameter Name="MoneyValue" Type="Double" />                       <asp:Parameter Name="ForecastPercentage" Type="Double" />                       <asp:Parameter Name="DueDate" Type="DateTime" />                       <asp:Parameter Name="UserKey" Type="Int32" />                   </UpdateParameters>               </asp:SqlDataSource>                               <asp:SqlDataSource ID="SqlDataSource2" runat="server"                                     ConnectionString="<%$ ConnectionStrings:XConnectionString %>"                                    SelectCommand="GetCompaniesByUser" SelectCommandType="StoredProcedure">                                     </asp:SqlDataSource>                                                                         <asp:SqlDataSource ID="SqlDataSource3" runat="server"                                     ConnectionString="<%$ ConnectionStrings:XConnectionString %>"                                    SelectCommand="GetForecastTypes" SelectCommandType="StoredProcedure">                                     </asp:SqlDataSource>                                                                          <asp:SqlDataSource ID="SqlDataSource4" runat="server"                                     ConnectionString="<%$ ConnectionStrings:XConnectionString %>"                                    SelectCommand="GetForecastPercentages" SelectCommandType="StoredProcedure">                                     </asp:SqlDataSource>                                                     <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1"                SkinID="Grey" AutoGenerateColumns="false" DataKeyNames="ForecastKey" AllowSorting="true"                OnRowDataBound="GridView1_RowDataBound" EditRowStyle-CssClass="dgedit" OnRowUpdated="GridView1_RowUpdated" OnRowEditing="GridView1_RowEditing"                OnRowDeleting="GridView1_RowDeleting">                   <Columns>                       <asp:TemplateField HeaderText="Key" SortExpression="ForecastKey">                                            <ItemTemplate>                                                <asp:Label ID="lblForecastKey" Text='<%# Bind("ForecastKey") %>' runat="server"></asp:Label>                                            </ItemTemplate>                                            <ItemStyle Height="24px" Width="50px" />                                            </asp:TemplateField>                                          <asp:TemplateField HeaderText="Company" SortExpression="CompanyName">                                            <ItemTemplate>                                                <asp:Label ID="lblCompany" Text='<%# Eval("CompanyName") %>' runat="server"></asp:Label>                                            </ItemTemplate>                                            <EditItemTemplate>                                                <asp:DropDownList ID="ddlCompanyName" DataSourceID="SqlDataSource2" Runat="Server"                                                 DataTextField="CompanyName" DataValueField="CompanyKey" SelectedValue='<%# Bind("CompanyKey") %>' />                                            </EditItemTemplate>                                            <ItemStyle Height="24px" Width="50px" />                                            </asp:TemplateField>                                                                                        <asp:TemplateField HeaderText="Forecast Type" SortExpression="ForecastDescription">                                            <ItemTemplate>                                                <asp:Label ID="lblForecastType" Text='<%# Eval("ForecastDescription") %>' runat="server"></asp:Label>                                            </ItemTemplate>                                            <EditItemTemplate>                                                <asp:DropDownList ID="ddlForecastType" DataSourceID="SqlDataSource3" Runat="Server"                                                 DataTextField="ForecastDescription" DataValueField="ForecastType" SelectedValue='<%# Bind("ForecastType") %>' />                                            </EditItemTemplate>                                            <ItemStyle Height="24px" Width="50px" />                                            </asp:TemplateField>                                                                                        <asp:TemplateField HeaderText="Value (£)" SortExpression="MoneyValue">                                            <ItemTemplate>                                                <asp:Label ID="lblMoneyValue" Text='<%# Eval("MoneyValue", "{0:#,###.00}") %>' runat="server"></asp:Label>                                            </ItemTemplate>                                            <EditItemTemplate>                                                <asp:TextBox ID="txtMoneyValue" Text='<%# Bind("MoneyValue", "{0:#,###.00}") %>' runat="server"></asp:TextBox>                                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"                                                ControlToValidate="txtMoneyValue" Display="None" ErrorMessage="Please enter a Value" />                                                <asp:CompareValidator ID="CompareValidator1" runat="server" Display="None"                                                ErrorMessage="Value must be numeric" ControlToValidate="txtMoneyValue"                                                Type="Double" Operator="DataTypeCheck"></asp:CompareValidator>                                            </EditItemTemplate>                                            <ItemStyle Height="24px" Width="50px" />                                            </asp:TemplateField>                                                                                        <asp:TemplateField HeaderText="Probability (%)" SortExpression="ProbabilityValue">                                            <ItemTemplate>                                                <asp:Label ID="lblProbability" Text='<%# Eval("ForecastPercentage") %>' runat="server"></asp:Label>                                            </ItemTemplate>                                            <EditItemTemplate>                                                <asp:DropDownList ID="ddlForecastPercentage" DataSourceID="SqlDataSource4" Runat="Server"                                                 DataTextField="ForecastPercentageDescription" DataValueField="ForecastPercentage" SelectedValue='<%# Bind("ForecastPercentage") %>' />                                            </EditItemTemplate>                                            <ItemStyle Height="24px" Width="50px" />                                            </asp:TemplateField>                                                                                        <asp:TemplateField HeaderText="Value (£) x Probability (%)" SortExpression="ProbabilityValue">                                            <ItemTemplate>                                                <asp:Label ID="lblProbabilityValue" Text='<%# Eval("ProbabilityValue", "{0:#,###.00}") %>' runat="server"></asp:Label>                                            </ItemTemplate>                                            <ItemStyle Height="24px" Width="50px" />                                            </asp:TemplateField>                                                                                        <asp:TemplateField HeaderText="Due Date" SortExpression="DueDate">                                            <ItemTemplate>                                                <asp:Label ID="lblDueDate" Text='<%# Eval("DueDate", "{0:dd/MM/yyyy}") %>' runat="server"></asp:Label>                                            </ItemTemplate>                                            <EditItemTemplate>                                               <asp:TextBox ID="txtDueDate" Text='<%# Bind("DueDate", "{0:dd/MM/yyyy}") %>' runat="server"></asp:TextBox>                                               <!--or use this in SQL : Select Convert(VarChar(10), GetDate(), 103)-->                                               <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"                                                ControlToValidate="txtDueDate" Display="None" ErrorMessage="Please enter a Due Date" />                                                <asp:CompareValidator ID="CompareValidator2" runat="server"                                               Display="None" ErrorMessage="Please enter a valid Due Date in format dd/mm/yyyy"                                               ControlToValidate="txtDueDate" Type="Date" Operator="DataTypeCheck"></asp:CompareValidator>                                            </EditItemTemplate>                                            <ItemStyle Height="24px" Width="65px" />                                            </asp:TemplateField>                                                                                        <asp:TemplateField HeaderText="Last Edit Date" SortExpression="LastEditDate">                                            <ItemTemplate>                                                <asp:Label ID="lblLastEditDate" Text='<%# Eval("LastEditDate", "{0:dd/MM/yyyy}") %>' runat="server"></asp:Label>                                            </ItemTemplate>                                            <ItemStyle Height="24px" Width="50px" />                                            </asp:TemplateField>                                                                                        <asp:CommandField ShowEditButton="True" ButtonType="Link" ShowCancelButton="True"                                            UpdateText="Update" EditText="Edit" CancelText="Cancel" />                                                                                        <asp:TemplateField>                                             <ItemTemplate>                                               <asp:LinkButton ID="DeleteButton"                                                  CommandArgument='<%# Eval("ForecastKey") %>'                                                  CommandName="Delete" runat="server">                                                 Delete</asp:LinkButton>                                             </ItemTemplate>                                           </asp:TemplateField>                                         </Columns>                </asp:GridView>
And here is my stored proc :
CREATE procedure dbo.UpdateForecast
( @ForecastKey int, @CompanyKey bigint, @ForecastType char(1), @MoneyValue float, @ForecastPercentage float, @DueDate datetime, @UserKey int)
as
update Forecastset CompanySiteKey = @CompanyKey,MoneyValue = @MoneyValue,Probability = @ForecastPercentage,ForecastType = @ForecastType,InvoiceDate = @DueDate,UserKey = @UserKeywhere ForecastKey = @ForecastKeyGO
Can anybody with more experience of using gridview please tell me where I am going wrong?
Cheers,
Mike

View 1 Replies View Related

Programmatically Setting UpdateParameters

Feb 14, 2008

I am trying to customize my update statement and this MUST happen in codebehind, otherwise I will be overwriting data.  The following is updating the data that is should be.  The problem is that eventhough my UpdateCommand is clear in my .aspx and there are no parameters set... It is STILL running it's own update and overwriting the information it isn't supposed to.  From what I can tell, it is using a default.  What can I do to prevent this?
SqlDataSource1.UpdateCommand = "UPDATE MyTable SET MyField1=@MyField1 WHERE MyField2=@MyField2 AND MyField3=@MyField3"SqlDataSource1.UpdateParameters.Add("MyField1", "CustomText")
SqlDataSource1.UpdateParameters.Add("Task_ID", "Parameter")SqlDataSource1.UpdateParameters.Add("Comments", "Parameter")
SqlDataSource1.Update()
 

View 3 Replies View Related

Programmatically Setting UpdateParameters For A SQLDataSource Control

Sep 8, 2006

I need to provide defaults and sometimes overrides for items in SQLDataSource's UpdateParameters. I am attempting to do this in a FormView's ItemUpdating and ItemInserting events as follows: //========================================================================
// FormView1_ItemUpdating:
//========================================================================
protected void FormView1_ItemUpdating(object sender, FormViewUpdateEventArgs e) {
// not sure if this is the bets place to put this or not?
dsDataSource.UpdateParameters["UpdatedTS"].DefaultValue = DateTime.Now.ToString();
dsDataSource.UpdateParameters["UpdatedUserID"].DefaultValue = ((csi.UserInfo)Session["UserInfo"]).QuotaUserID;
}
 In the example above I am attempting to set new values for the parameters which will replace the existing values. I have found that using the DefaultValue property works ONLY if there is no current value for the parameter.  Otherwise the values I specify are ingnored.The parameters of an ObjectDataSource provide a Value property but SQLDataSource parameters do not.How can I provide an override value without needing to place the value in the visible bound form element???If you can answer this you will be the FIRST person ever to answer one of my questions here!!!Thanks,Tony 

View 2 Replies View Related

Ddl Doesn't Populate

Feb 6, 2008

Anybody see a reason why this list won't populate?
<asp:DropDownList ID="ddlState" DataSourceID="srcStates"    DataTextField="StateName" DataValueField="StateName" runat="server">    <asp:ListItem>Select State</asp:ListItem></asp:DropDownList><asp:SqlDataSource ID="srcStates" runat="server" ConnectionString="<%$ ConnectionStrings:webConn %>"    SelectCommand="sp_States" SelectCommandType="StoredProcedure">    <SelectParameters>        <asp:ControlParameter ControlID="ddlState" DefaultValue="Select State" Name="State"            PropertyName="SelectedValue" Type="String" />    </SelectParameters></asp:SqlDataSource>

View 6 Replies View Related

How Do I Populate A Listbox From A SQL DB?

Feb 10, 2004

Sorry if this is to basic but I am just starting out. Any help is appreciated.

Basically I am attempting to populate a listbox with items from a MSSQL DB so the user can select either one or multiple items in that listbox to search on.

View 1 Replies View Related

Need To Populate Columns For Whole ID

Feb 2, 2015

I have data like below, I need to populate the ID_INDICATOR columns with the below condition

ID TASK_ID TASK_COMPLETEDTSTASK_DUETSTASK_INDICATORID_INDICATOR
112014-06-09 00:00:002014-06-11 00:00:00GREEN
122014-06-13 00:00:002014-06-14 00:00:00AMBER
132014-06-17 00:00:002014-06-16 00:00:00RED
142014-06-17 00:00:002014-06-18 00:00:00AMBER

Condition:
##########

Red = If ID due date was overdue, i.e. if last task completed after the ID end date(2014-06-18 00:00:00).
AMBER= If any task in the ID is overdue but completed before the ID end date(2014-06-18 00:00:00)
Green = If all tasks were completed on time.

I am looking for the logic to implement the AMBER for the whole ID, because the TASK_ID 3 is overdue, but completed before the ID end date (2014-06-18 00:00:00).

View 6 Replies View Related

Trying To Populate A Name Column

Sep 18, 2006

I am trying to update a name column in the following way: (I wrote a description, but I think this visual is easier to understand).

This is what I have:

name1 name2 address etc

Bob null 123 street

Sue null 123 street

Jack null ABC circle



This is what I want:

name1 name2 address etc

Bob Sue 123 street

Jack null ABC circle



I'm just trying to get 2 names on the same row if they have the same address and get rid of the spare row. Name2 is currently null. Seems simple enough but I don't know how to do it in SQL. I can do it in FoxPro, but that doesn't help me here.

Thanks for any ideas.





View 3 Replies View Related

How Do You Populate A New Index?

May 5, 2008

I added an index to a SQL Server 2005 table. How do I populate that index? I thought it might be automatically populated but the operation to add the index happened so quickly that I don't think it could have done it that quickly. Also, I expected faster performace when selecting rows based on the indexed column, but performance remains the same.

View 1 Replies View Related

Populate A Variable

Oct 24, 2006

During a dataflow - I like to populate a variable with True or False based on a value in one of the data records.

How do I do this excercise ?

 if I use a script - can someone provide me with simple script on how to populate one variable ?

 

Thanks heaps

 

 

 

 

View 11 Replies View Related

How Can I Populate Data In A One-to-one Relationship

Jul 20, 2006

Here is what I have and (somewhat understand).  I’m using Visual Web
Developer 2005 Express Edition and have setup my application to use form authentication
(which automatically creates the ASPNETDB.MDF file with several default tables
and views).  I’m using the CreateUserWizard
which is fine…but I need to collect additional information like (firstname,
lastname, address…and on..).  What I’ve
done.  I’ve created a tabled named
UserProfile and set UserId as the primary key (uniqueidentifier). 
 I then setup a 1-to-1 relationship
between aspnet_Users and UserProfile (which I think is correct).  On my UpdateContactInfo.aspx page (where
users go to update their personal information) I use a hidden label control
(UserValue) to receive the UserId during the page_load event as below:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load        UserValue.Text = Membership.GetUser().ProviderUserKey().ToString()    End Sub Now with the UserID available I need to populate the
UserProfile table with the UserId, firstname, lastname, address of the
currently logged in user.   How can I do this and am I on the
right track..?

View 6 Replies View Related

Populate Arraylist From A Database

Sep 15, 2006

Hi  i'm pretty new to this, how do i connect to my database a put all the values from one column into the arraylist. Any help and a easy example would be nice Thanks in advance  Richard 

View 4 Replies View Related

Populate Binay Data

Oct 16, 2006

We have stored large text data in "Image" data type in SQL Server. Can someone tell me how to get that vlaue from image datafield. Thanks

View 3 Replies View Related

Populate The Array From Database

Oct 18, 2006

Hi,   I want to populate the array with a single column values from database(sqlserver 2000)Ex. name      ageaaaa         23bbbb         43cccc         18 Now i want to populate the array with name field values. Please anyone guide me how to do this.Thanks in advanceBala

 

View 3 Replies View Related

Populate DB Records In Array

Nov 9, 2006

Using the SqlDataReader, I am retrieveing records from a SQL Server 2005 DB table. Since I am using the SqlDataReader to retrieve the records from the DB, I have to use the Read method of the SqlDataReader like this:Dim sqlReader As SqlDataReaderWhile(sqlReader.Read)    Response.Write(sqlReader.GetValue(0) & "<br>")    Response.Write(sqlReader.GetValue(1) & "<br>")    Response.Write(sqlReader.GetValue(2) & "<br>")End WhileThe records retrieved can only be accessed inside the While loop. I want to access the records outside the While loop as well. Is there anyway by which I can do this, maybe by populating the recordset in an array variable & then using it outside the While loop?

View 3 Replies View Related

How To Populate A ArrayList With A IDataReader

Jan 18, 2007

In my data access layer class I have Populate methods on the bottom.One of the the objects, color, is an ArrayList, how do I write that?         private Product PopulateProduct(IDataReader r)        {            Product product = new Product();            product.BrandId = Convert.ToInt32(r["brandId"]);            product.BrandName = Convert.ToString(r["brandName"]);            product.Color = whatGoesHere?  (r["color"]);  return product;        }  thanks 

View 4 Replies View Related

Populate Dropdown Box From SQL In Web Matrix?

Jan 22, 2004

I have been attempting to populate a dropdown (combo) box from a SQL query (SQLConnector) in Web Matrix and I have so far been unsuccessful. I have been able to populate a DataGrid just fine from the query, so then I limited it down to one colum (so itd be in the dropdown box) and set all the properties I could find (DataSource, DataMember, DataTextField, DataValueField) (and in all possible combinations) for that dropdown box to the SQL stuff (SQLConnector for the DataSource and then used the dropdowns for the others), and nothing shows up in my dropdown box. How can I make this populate off of my SQL query properly?

Additionally I will need to do the same thing for a Checkbox List so if it is the same and you know how to do that and could let me know for that too that'd be great.

Thanks a million in advance!

View 1 Replies View Related

Two DB Tables To Populate One Control

Jun 20, 2004

I have a dropdownlist that is populated from a DB table. I would like to also include any other values that might be in another table. How do I combine these two queries, so I can get distinct values from both tables combined?SELECT Category
FROM dbo.TABLE1
GROUP BY Category

SELECT Category
FROM dbo.TABLE2
GROUP BY Category

View 1 Replies View Related

Populate Textbox From DataSource

May 15, 2006

Can someone tell me what I am doing wrong... I am trying to populate some textboxes from a table by doing a SELECT statment. 
Any help would be greatly appreciated
T.
 
Code:
Dim myConnection As SqlConnection
Dim myCommand As SqlDataAdapter
myConnection = New SqlConnection("Server=.SQLEXPRESS;AttachDbFilename=|DataDirectory|CustomerInfo.mdf;Integrated Security=True;User Instance=True")
myCommand = New SqlDataAdapter("SELECT * FROM [CustomerSalesNum] WHERE [WorkSheetID]= '" & lblRWorkSheetID.Text & "'", myConnection)
Dim ds As DataSet = New DataSet("CustomerSalesNum")
ds = New DataSet("CustomerSalesNums")
tbUPPRice.Text = ds.Tables["CustomerSalesNums"].Rows[0]["Price"].ToString();

View 5 Replies View Related

Populate Star Schema By DTS

Dec 18, 2002

does any one know how to built a star schema by DTS:confused:

View 4 Replies View Related

Please Help Me Populate My Date Fields

May 7, 2004

Hi,

I have the following table:

CREATE TABLE [Orders] (
[OrdID] [int] ,
[OrderDate] [datetime] ,
[OrderDateONLY] [datetime],
[OrderDayName] [nvarchar] (15),
[OrderMonth] [nvarchar] (25),
[OrderDayOfMonth] [smallint] NULL ,
[OrderWeekofYear] [smallint] NULL
)
GO

The field OrderDate contains BOTH Date and Time information. What I want to do is populate the fields (in bold above) from the OrderDate field... I have tried all that I could think of but nothing works. The last and the best try that I gave was the {B}following[/B] but that too does not work. Can you PLEASE help. Many thanks in advance:


Insert ORDERS
(OrderDateONLY, OrderDayName, OrderMonth, OrderDayOfMonth, OrderWeekofYear)
select
d, datename (dw, d), datename (mm, d), Year (d), datepart (ww, d)
from
(select convert (char (8), OrderDate, 112)as d
from ORDERS
) as x

View 3 Replies View Related

Using Cursors To Populate A Column

May 10, 2002

I am trying to populate a column with date/time info, I am doing this so I can use getdate() on the data for other computations (the format is mon/day/yr/hours/mins, i was told only data having mon/day/yr format can be used with getdate()). The code below says that dateyest is an invalid object name. Actually, any kind of insert I do reports the same error, no matter what column it is (securty on my account is all set, as well as for the stored proc.). I must be overlooking something very simple, right? thanks for the help!

DECLARE @dateYest datetime
DECLARE Cur668 CURSOR
Keyset
FOR
SELECT cast(date1 as datetime) dt
FROM baclosetable
OPEN Cur668

fetch next from cur668 into @dateyest

WHILE @@FETCH_STATUS = 0
BEGIN
if @dateyest is not null
Insert dateyest VALUES (@dateYest)
fetch next from cur668 into @dateyest
END
CLOSE Cur668
DEALLOCATE Cur668

View 5 Replies View Related

Using Other Columns To Populate Filename...

Feb 23, 2006

Basically like the topic says, I need to populate a filename with data from other columns and im having a tough time doing it.

Code:


UPDATE nice_cls_calls_0027
SET vcarchivepath = 'G:Nice Storageicestorage.safeautonet.netSafe Auto Task - Logger (807101)2006_feb_1SC_807101_'start_time'_'=stop_time'_'=channel'_'=cls_call_id'.aud'


I need start_time, stop_time, channel, and cls_call_id to populate the filename. The first 2 are datetime fields in the db and no conversion is needed for them, just raw data. The remaining two are smallint and raw data is needed there also. Any help would be greatly appreciated. TY

View 4 Replies View Related

Access ComboBox Won't Populate

Dec 13, 2005

I'm using SQLServer2000/Access 2000 .adp. The .adp has a form with 2 combo boxes. The 1st combo box is bound to a stored procedure and loads fine when the form loads. I then set the 2nd combo box's RowSource passing the value of the first into the stored proc:

Me.secondComboBox.RowSource = "EXEC dbo.proc_My2ndProc '" & Me.cboFirstComboBox & "'"
Me.cbosecondComboBox.reQuery

Why won't it work? I've set a form's RecordSource using this methof, and it works great???

Thanks,
Carl

View 1 Replies View Related

Trigger Fires In One Db And Populate Another Db

Apr 12, 2007

hi,

I want a trigger in db aaa to fire when table a_aaa is updated in server a and table b_bbb in db bbb in server b to be populated with data. I know how to write a trigger if fired and the result stays in one server with one db. But I don't know how to do it if between two servers and two db.

a
win server 2003 standard Edition
sql Server 2000
db:aaa
table: a_aaa
column:a_aaa_a

b
win server 2003 standard Edition
sql Server 2000
db:bbb
table:b_bbb
column: b_bbb_b

It's not working because the symtax is incorrect and because I am not sure how to do it between two servers. If it is not correct, where am I wrong? Where should each line be located?? et cetera......
Can anyone help?

Thanks in advance.




CREATE TRIGGER [enddate_changed_on_alert] ON [dbo].[USER_DATA]

FOR INSERT, UPDATE
AS

BEGIN
SET NOCOUNT ON;

DECLARE @EndDate as DATE
DECLARE @CompCode as VARCHAR(15)
DECLARE @PhoneGMSM as VARCHAR(10)
DECLARE @PhoneALERT as VARCHAR(10)

SELECT @PhoneALERT=phone1 from AUSSMEDEVIQ1.QDB_Test.USER_DATA;
SELECT @PhoneGMSM=PHONE1 from AUSADFORMULA02.QDB_KS.dbo.USER_DATA_DEVIQ;

UPDATE AUSADFORMULA02.QDB_KS.dbo.USER_DATA_DEVIQ SET EXT4 = "111"
WHERE AUSSMEDEVIQ1.QDB_Test.USER_DATA.@Phone = AUSADFORMULA02.QDB_KS.dbo.USER_DATA_DEVIQ;


WHERE:

USER_DATA_DEVIQ = b_bbb_b
AUSADFORMULA02 = bbb
QDB_KS = b_bbb
USER_DATA = a_aaa_a
AUSSMEDEVIQ1 = aaa
QDB_Test = a_aaa

END
GO

View 9 Replies View Related

How To Populate A Table From A Sql Statement

Aug 28, 2007

Hello,
In a Data Flow Task, I have an OLE DB source that uses the following SQL Statement;

******************************************

--First create a table

DECLARE @CategoryTable TABLE
(ColID Int,
ColCategory varchar(60),
ColValue varchar(500)
)

--and fill it

INSERT INTO @CategoryTable
(ColID, ColCategory, ColValue)
SELECT
0,
LEFT(RawCollectionData,CHARINDEX(':',RawCollection Data)),
LTRIM(SUBSTRING(RawCollectionData,CHARINDEX(':',Ra wCollectionData)+1,255))
FROM Collections_Staging

--Assign an ID to each block of data for each occurance of 'Reason:'

DECLARE @ID int
SET @ID = 1
UPDATE @CategoryTable
SET [ColID] = CASE WHEN ColCategory = 'Reason:' THEN @ID - 1 ELSE @ID END,
@ID = CASE WHEN ColCategory = 'Reason:' THEN @ID + 1 ELSE @ID END

--Then put the data together

SELECT --cast to Nvarchar for MSAccess
a.ColID,
CAST(a.ColValue as Nvarchar(30)) AS OrderID,
COALESCE(CAST(b.ColValue as Nvarchar(30)),'') AS SellerUserID,
COALESCE(CAST(c.ColValue as Nvarchar(100)),'') AS BusinessName,
COALESCE(CAST(d.ColValue as Nvarchar(15)),'') AS BankID,
COALESCE(CAST(e.ColValue as Nvarchar(15)),'') AS AccountID,
COALESCE(CAST(SUBSTRING(f.ColValue,CHARINDEX('$',f .ColValue)+1,500)AS DECIMAL(18,2)),0) AS CollectionAmount,
COALESCE(CAST(g.ColValue as Nvarchar(10)),'') AS TransactionType,
CASE
WHEN h.ColValue LIKE '%Matching Disbursement%' THEN NULL
ELSE CAST(h.ColValue AS SmallDateTime)
END AS DisbursementDate,
--COALESCE(h.ColValue,'') AS DisbursementDate,
CASE
WHEN i.ColValue LIKE '%Matching Disbursements%' THEN NULL
WHEN CAST(LEFT(REVERSE(i.ColValue),4)AS INT) > 1000 THEN CAST(i.ColValue AS SmallDateTime)
WHEN LEFT(REVERSE(i.ColValue),4) = '1000' THEN NULL
END AS ReturnDate,
--COALESCE(i.ColValue,'') AS ReturnDate,
COALESCE(CAST(j.ColValue as Nvarchar(4)),'') AS Code,
COALESCE(CAST(k.ColValue as Nvarchar(255)),'') AS CollectionReason

FROM @CategoryTable a
LEFT JOIN @CategoryTable b ON b.ColID = a.ColID AND b.ColCategory = 'Seller UserId:'
LEFT JOIN @CategoryTable c ON c.ColID = a.ColID AND c.ColCategory = 'Business Name:'
LEFT JOIN @CategoryTable d ON d.ColID = a.ColID AND d.ColCategory = 'Bank ID:'
LEFT JOIN @CategoryTable e ON e.ColID = a.ColID AND e.ColCategory = 'Account ID:'
LEFT JOIN @CategoryTable f ON f.ColID = a.ColID AND f.ColCategory = 'Amount:'
LEFT JOIN @CategoryTable g ON g.ColID = a.ColID AND g.ColCategory = 'Transaction Type:'
LEFT JOIN @CategoryTable h ON h.ColID = a.ColID AND h.ColCategory = 'Disbursement Date:'
LEFT JOIN @CategoryTable i ON i.ColID = a.ColID AND i.ColCategory = 'Return Date:'
LEFT JOIN @CategoryTable j ON j.ColID = a.ColID AND j.ColCategory = 'Code:'
LEFT JOIN @CategoryTable k ON k.ColID = a.ColID AND k.ColCategory = 'Reason:'

WHERE a.ColCategory = 'Order ID:'

***************************************

This statement parses. I can preview the data. I've tried to set up both an OLE DB destination to a SQL Server table and an MS Access table destination (Jet). In either case, the data will not populate the tables. I set up a Data Viewer, and no data appears in the Viewer. With the Access destination, I have the package set up to run in 32 bit mode.

If data appears in the preview, then why doesn't the data appear in the data viewer, and why will the data not populate either of the destination tables?

Thank you for your help!

CSDunn

View 1 Replies View Related

Please Help Me Populate My Date Fields

May 7, 2004

Hi,

I have the following table:

CREATE TABLE [Orders] (
[OrdID] [int] ,
[OrderDate] [datetime] ,
[OrderDateONLY] [datetime],
[OrderDayName] [nvarchar] (15),
[OrderMonth] [nvarchar] (25),
[OrderDayOfMonth] [smallint] NULL ,
[OrderWeekofYear] [smallint] NULL
)
GO

The field OrderDate contains BOTH Date and Time information. What I want to do is populate the fields (in bold above) from the OrderDate field... I have tried all that I could think of but nothing works. The last and the best try that I gave was the following but that too does not work. Can you PLEASE help. Many thanks in advance:


Insert ORDERS
(OrderDateONLY, OrderDayName, OrderMonth, OrderDayOfMonth, OrderWeekofYear)
select
d, datename (dw, d), datename (mm, d), Year (d), datepart (ww, d)
from
(select convert (char (8), OrderDate, 112)as d
from ORDERS
) as x

View 7 Replies View Related

SP To Populate Immunization Into A Grid

Mar 4, 2015

I have below SP that populates immunization into a grid. I need to add last_name, first_name from person table.

Each record in dB is tied to a patient by their person_id and Person table has this as well.

All I need to tie this grid and add last_name, first_name into this grid. I added 2 lines but its not working for me?

quote:
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[ngkbm_unmapped_vaccines]

[Code] ....

View 12 Replies View Related

Populate The Fact Table

Jun 6, 2007

Hi!

can any body tell me how to populate the fact table from base tables.

View 4 Replies View Related

How To Populate The Fact Table

Jun 6, 2007

databse name: bookorder

Realtions:

customer (customerid,l_name,f_name,city, district,country)
cust_order(orderid,orderdate,customerid)
order_detail(orderid,itemno,isbn,quantity)
book(isbn,title,edition_no,price)
author(authorid,name,surname)
book_author(authorid,isbn,authorseqno)


Now populate the datawarehouse name: book_orderdw
having fact table & three dimension tables given below from the above bookorder database

fact table

factsales(customerid,timeid,isbn,unit_price,discount_price,sales_quantity,sales_amount)

dimension tables

dimcustomer(customerid,l_name,f_name,city,district,country)
dimtime(timeid,orderdate,dayofweek, month, year)
dimbook(isbn,title,edition_no,price)

Now I have to populate the fact & dimension tables by writing sql scripts.
Now I have already populated the dimension tables by writing sql script,
But I have to populate the fact table taking into account, here I am facing problem in wriring sql script

(i) unit_price is taken from the book base table with reference to the isbn
(ii) sales_quantity is taken from the order_detail.quantity with reference to table cust_order(via orderid & orderdate)
(iii) discount_price is determined dependent on the quantity. if the quantity > 20 then discount 20 %(i.e discount_price = 0.8 * unit_price). if quantity < 10, no discount i.e normal price. if quantity between 10 and 20, discount 10%. Note that the quantity is determined based on each order of each customer, thus if the same book appears at multiple positions in an order, those positions shall be grouped together. This could happen because the pk of the order_detail table is order_id + item no, not order_id + isbn
(iv) sales_amount is sales_quantity * discount_price

View 1 Replies View Related

Using Trigger To Populate Another Table

Jul 20, 2005

Hi all,I have two tables tbl_A and tbl_B.Table Definitions:tbl_A (field_1, field_2, field_3)tbl_B (field_1, field_2)I would like to populate tbl_B when a record is inserted into tbl_A.Note that tbl_A.field_1 = tbl_B.field_1 and tbl_A.field_2 =tbl_B.field_2 .How do I write a trigger on tbl_A to get the corresponding recordinserted into tbl_B?RegardsJune.....

View 2 Replies View Related

Trigger To Populate Another Table.

Jul 20, 2005

Hi.I have a problem I hope someone can help me with.I have a database of events. Each event has a date and a duration(days).What I need to do is to be able to display search for events on someweb pages. My problem is that if an event is on say 15 nov 2004 andhas a duration of 3 days, at the moment if someone searches for the16th nov 2004 that event wont show up. To solve this what I have triedto do is put a trigger on my events table that populates another tableeach time a record is inserted. In the other table (orderedevents) anentry is added for each day specified in the duration field. I can thequery this table for the search. For example if this is added into theevents tableTitle: Event1Date: 15/11/2004Duration: 3Then this would be added to the orderedevents tableTitle: Event1Date: 15/11/2004Duration: 3Title: Event1Date: 16/11/2004Duration: 3Title: Event1Date: 17/11/2004Duration: 3This is what I have got so far. Someone kindly helped me with thisbefore but they had developed it on MySql, I'm using Sql Server and itdoesn't seem to work. All it does is add a blank row to OrderedEvents.Can anyone suggest any amendments that will make it work on SqlServer?CREATE Trigger TriggerInsertOrderedEventsON eventsFOR INSERTASSET NOCOUNT ONDECLARE @CountDuration int,@FixedDuration int,@eventdate datetime,@EventTitle varcharSET @CountDuration = 0SET @EventTitle = (SELECT EventTitle FROM inserted)SET @FixedDuration = (SELECT EventDuration FROM inserted)SET @EventDate = (SELECT EventDate FROM inserted)WHILE (@CountDuration <= @FixedDuration - 1)BEGININSERT OrderedEvents (Eventdate,EventDuration,EventTitle)VALUES(dateadd(day,@CountDuration,@EventDate),@Fix edDuration,@EventTitle)SET @CountDuration = @CountDuration + 1ENDSET NOCOUNT OFFThanks in advance.

View 3 Replies View Related







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