SqlDataSource, DataView, CType Function && Page_Load-Compilation ErrorBC30451: Name 'SqlDataSource3' Is Not Declared.

Nov 7, 2006

Hi all,

In my VWD 2005 Express, I created a website "AverageTCE" that had Default.aspx, Default.aspx.vb and App_Code (see the attached code) for configurating a direct SqlDataSource connection to the dbo.Table "LabData" of  my SQL Server 2005 Express "SQLEXPRESS" via SqlDataSource, DataView, CType Function and the Page_Load procedure. I executed the website "AverageTCE" and I got Compilation ErrorBC30451: Name 'SqlDataSource3' is not declared:



Server Error in '/AverageTCE' Application.


Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30451: Name 'SqlDataSource3' is not declared.

Source Error:









Line 8: <DataObjectMethod(DataObjectMethodType.Select)> _
Line 9: Public Shared Function SelectedConcentration() As ConcDB
Line 10: Dim dv As DataView = CType(SqlDataSource3.Select(DataSourceSelectArguments.Empty), DataView)
Line 11: dvConcDB.RowFilter = "Concentration = '" & ddlLabData.SelectedValue & "'"
Line 12:


Source File: C:Documents and Settingse1enxshcMy DocumentsVisual Studio 2005WebSitesAverageTCEApp_CodeConcDB.vb    Line: 10
//////////--Default.aspx--//////////////////////////

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

<title>SQL DataSource</title>

</head>

<body>

<form id="form1" runat="server">

 

<div>

Average TCE<br />

<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource2"

DataTextField="SampleID" DataValueField="SampleID">

</asp:DropDownList><asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ChemDatabaseConnectionString2 %>"

SelectCommand="SELECT [SampleID] FROM [LabData]"></asp:SqlDataSource>

<br />

<br />

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="SampleID"

DataSourceID="SqlDataSource1">

<Columns>

<asp:BoundField DataField="SampleID" HeaderText="SampleID" ReadOnly="True" SortExpression="SampleID" />

<asp:BoundField DataField="SampleName" HeaderText="SampleName" SortExpression="SampleName" />

<asp:BoundField DataField="AnalyteName" HeaderText="AnalyteName" SortExpression="AnalyteName" />

<asp:BoundField DataField="Concentration" HeaderText="Concentration" SortExpression="Concentration" />

</Columns>

</asp:GridView>

<asp:SqlDataSource ID="ddlLabData" runat="server" ConnectionString="<%$ ConnectionStrings:ChemDatabaseConnectionString %>"

SelectCommand="SELECT * FROM [LabData] WHERE ([SampleID] = @SampleID)">

<SelectParameters>

<asp:ControlParameter ControlID="DropDownList1" DefaultValue="3" Name="SampleID"

PropertyName="SelectedValue" Type="Int32" />

</SelectParameters>

</asp:SqlDataSource>

<br />

<asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:ChemDatabaseConnectionString3 %>"

SelectCommand="SELECT * FROM [LabData]"></asp:SqlDataSource>

<br />

<br />

LabData-Analyte:&nbsp;

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />

<br />

LabData-Conc:

<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br />

<br />

Average values: &nbsp;

<asp:Label ID="Label1" runat="server" Text="lblAverageValue"></asp:Label><br />

<br />

<br />

<br />

 

</div>

</form>

</body>

</html>

///////////--Default.aspx.vb--////////////////////////////////

Partial Class _Default

Inherits System.Web.UI.Page

End Class

////////////////--App_Code/ConcDB.vb--//////////////////////

Imports Microsoft.VisualBasic

Imports System.ComponentModel

Imports System.Data

Imports System.Data.SqlClient

Imports System.Data.SqlTypes

<DataObject(True)> Public Class ConcDB

<DataObjectMethod(DataObjectMethodType.Select)> _

Public Shared Function SelectedConcentration() As ConcDB

Dim dv As DataView = CType(SqlDataSource3.Select(DataSourceSelectArguments.Empty), DataView)

dvConcDB.RowFilter = "Concentration = '" & ddlLabData.SelectedValue & "'"

Dim dvRow As DataRowView = dvConcDB(0)

Dim ConcDB As New ConcDB

ConcDB.SelectedConcentration = CDec(0)("Concentration")

Return ConcDB

End Function

Call AverageValue (Conc1)

Public Shared Function AverageValue(ByVal Conc1 As Decimal)

Dim AverageConc As Decimal

AverageConc = (Conc1 + 22.0) / 2

Return AverageConc

End Function

End Class

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

I have 2 questions to ask:

1)  How can I fix this Compilation Error BC30451: Name 'SqlDataSource3' is not declared?
 

2) I just read MSDN Visual Studio 2005 Technical Article "Data Access in ASP.NET 2.0" and I saw the following thing:

    Types of Data Sources:

      SqlDataSouirce:   The configuration of a SqlDataSoure is more complex then that of the AccessDataSource, and is intended

                                      for enterprise applications that require the features provided by a true database management system

                                       (DBMS).

    I am using the website application in VWD 2005 Express to do the task of extracting data values from the Tables of SQL Server 2005 Express via .NET Framwork, ASP.NET 2.0 and VB 2005 programming.  Can VWD 2005 Express be configured to SQL Server 2005 Express (SQLEXPESS) for the SqlDataSource connection and do the data-extraction task via DataView, CType Function and the Page-Load procedure?

Please help, respond and answer the above-mentiopned 2 questions.

Many Thanks,

Scott Chang 

View 2 Replies


ADVERTISEMENT

Sqldatasource How To Not Load The Gridview With The SqldataSoruce At Page_load C#

May 11, 2007

hello all
1)   I was using SQLdataSource and bind it with the gridviw to show its data.  so that is how is running
      when the page load,  i see the data is posted on the page on the gridview.
      But what i need to do when I want a user to click a button  and then the Gridview show the data.
 
   As i was creating a SQLDatasource, it was click click and click but  I want to put that sqldatasouce to load the data in gridview by a click event.
 
2) my second question is also related to the first one or just similar.
I dont want to get all the data rather filter it.  
so once the page load,  there is a button and a text box.
In the text box user going to type the EmployeeID and click the "Employee Info" button and then the data would show up. 
Rather i use te DetaildView Control . What should I do to load the information on the Text boxes rather then on the GridView since it is going to be a single recrod.  
Thanks all
 

View 1 Replies View Related

Programmatic Use Of SQLDataSource Not Returning Dataview

Sep 4, 2007

I am creating an ad-hoc reporting module for my website.  The user may select a list of columns and specify the WHERE for the report.  I build the select statement and the where statement and pass the info to a stored procedure.  The stored procedure accepts 3 select parameters and a 3 wherestmt parameters.  I finally got the SQLDatasource to work by setting the parameter values in the Selecting method of the SQLDatasource.  Binding it to a gridview shows me all my values.  Now, I am trying to programmatically call the select method of the SQLDatasource so I can get a dataview or datareader to manipulate further.  I am getting an null back when I call the select method.  Any ideas why? or a workaround?
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:AssetMgmtRWConnectionString %>"SelectCommand="getAdhocRptData" SelectCommandType="StoredProcedure" DataSourceMode="DataReader">
<SelectParameters>
<asp:Parameter Name="strSelect" Type="String" />
<asp:Parameter Name="strSelect2" Type="String" />
<asp:Parameter Name="strSelect3" Type="String" />
<asp:Parameter Name="strWhere" Type="String" />
<asp:Parameter Name="strWhere2" Type="String" />
<asp:Parameter Name="strWhere3" Type="String" />
<asp:Parameter Name="bitDebug" Type="Boolean" />
</SelectParameters>
</asp:SqlDataSource>
 
<VB Code>Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Getting an error that the object is null? why is the above code not returning any data?
'Tried using a datareader and datasource.Dim rptview As IDataReader = CType(SqlDataSource1.Select(DataSourceSelectArguments.Empty), IDataReader)
If rptview.Read Then
lblMsg.Text = "Got Rows"
End If
End Sub
Protected Sub SqlDataSource1_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles SqlDataSource1.Selecting
'For this sp, need to set each paramater even if it is not being used. Setting it in the wizard
'does not work. Need to be set programmatically.
e.Command.Parameters("@strSelect").Value = "p.field1, p.field2 "
e.Command.Parameters("@strSelect2").Value = "s.field1, s.field2"
e.Command.Parameters("@strSelect3").Value = "a.field1, a.field2, a.field4, a.field5"
e.Command.Parameters("@strWhere").Value = "p.field3 is not null and a.field5 is null"
e.Command.Parameters("@strWhere2").Value = "'"
e.Command.Parameters("@strWhere").Value = ""
e.Command.Parameters("@bitdebug").Value = False
End Sub
 
thanks for any help.
 

View 2 Replies View Related

Function Returning Error During Compilation.....

Feb 12, 2004

Hi ,

I am creating a function which is going to return a table. The Code ofr the function is as follows...
===============================
Create function udf_qcard (@cg1 varchar(25)) returns @rec_card table (t_cusip varchar(10),t_data varchar(70))
AS
begin
declare @t1_sys char(10),@t1_all varchar(11)
declare @temp_qcard table (tdata varchar(11) collate SQL_Latin1_General_CP1_CS_AS)
if (substring(@cg1,1,2)='Q$')
set @cg1 = (select substring(@cg1,3,len(@cg1)) where substring(@cg1,1,2)='Q$')
DECLARE c1 SCROLL CURSOR FOR select groups_system, substring(groups_alldata,3,10) from tbl_groups
where groups_system = @cg1 and groups_alldata like 'Q$%' and groups_seq>=1 FOR READ ONLY
insert into @temp_qcard values(@cg1)
OPEN C1
FETCH NEXT FROM c1 INTO @t1_sys,@t1_all
WHILE @@FETCH_STATUS = 0
BEGIN

insert into @temp_qcard values(@t1_all)

declare @t2_sys char(10),@t2_all varchar(10)
DECLARE c2 SCROLL CURSOR FOR select groups_system, substring(groups_alldata,3,10) from tbl_groups
where groups_system = @t1_all and groups_alldata like 'Q$%' and groups_seq>=1 FOR READ ONLY

begin
OPEN C2
FETCH NEXT FROM c2 INTO @t2_sys,@t2_all
WHILE @@FETCH_STATUS = 0
BEGIN
insert into @temp_qcard values(@t2_all)

declare @t3_sys char(10),@t3_all varchar(10)
DECLARE c3 SCROLL CURSOR FOR select groups_system, substring(groups_alldata,3,10) from tbl_groups
where groups_system = @t2_all and groups_alldata like 'Q$%' and groups_seq>=1 FOR READ ONLY

begin

OPEN C3
FETCH NEXT FROM c3 INTO @t3_sys,@t3_all
WHILE @@FETCH_STATUS = 0
BEGIN
insert into @temp_qcard values(@t3_all)
FETCH NEXT FROM c3 INTO @t3_sys,@t3_all
end
end
close c3
deallocate c3
FETCH NEXT FROM c2 INTO @t2_sys,@t2_all
end
end
close c2
DEALLOCATE c2

FETCH NEXT FROM c1 INTO @t1_sys,@t1_all
END

CLOSE c1
DEALLOCATE c1
Insert @rec_card select groups_q+groups_cusip,groups_data from tbl_groups
where groups_system in (select tdata from @temp_qcard) and groups_seq>=1 and groups_alldata not like 'Q$%' order by groups_alldata

RETURN
END
==========================

While compiling this I am getting the Below error ....
==================
Server: Msg 1049, Level 15, State 1, Procedure udf_qcard, Line 10
Mixing old and new syntax to specify cursor options is not allowed.
Server: Msg 1049, Level 15, State 1, Procedure udf_qcard, Line 23
Mixing old and new syntax to specify cursor options is not allowed.
Server: Msg 1049, Level 15, State 1, Procedure udf_qcard, Line 35
Mixing old and new syntax to specify cursor options is not allowed.
=================

Can Anyone please help me how to resolve this issue...

Thanks with Regards.

-Mohit.

View 1 Replies View Related

Trouble Porting A Trivially Simple Function - With Declared Variables

Aug 4, 2006

Here is one such function:CREATE FUNCTION my_max_market_date () RETURNS datetimeBEGINDECLARE @mmmd AS datetime;SELECT max(h_market_date) INTO @mmmd FROM holdings_tmp;RETURN @mmmd;ENDOne change I had to make, relative to what I had working in MySQL, wasto insert 'AS' between my variable and its type. Without 'AS', MS SQLinsisted in telling me that datetime is not valid for a cursor; and Iam not using a cursor here. The purpose of this function is tosimplify a number of SQL statements that depend on obtaining the mostrecent datetime value in column h_market_date in the holdings_tmptable.The present problem is that MS SQL doesn't seem to want to allow me toplace that value in my variable '@mmmd'. I could do this easily inMySQL. Why is MS SQL giving me grief over something that should be sosimple. I have not yet found anything in the documentation for SELECTthat could explain what's wrong here. :-(Any ideas?ThanksTed

View 6 Replies View Related

SqlDataSource.Select Error: Unable To Cast Object Of Type 'System.Data.DataView' To Type 'System.String'.

Oct 19, 2006

I am trying to put the data from a field in my database into a row in a table using the SQLDataSource.Select statement. I am using the following code: FileBase.SelectCommand = "SELECT Username FROM Files WHERE Filename = '" & myFileInfo.FullName & "'" myDataRow("Username") = CType(FileBase.Select(New DataSourceSelectArguments()), String)But when I run the code, I get the following error:Server Error in '/YorZap' Application. Unable to cast object of type 'System.Data.DataView' to type 'System.String'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Data.DataView' to type 'System.String'.Source Error: Line 54: FileBase.SelectCommand = "SELECT Username FROM Files WHERE Filename = '" & myFileInfo.FullName & "'"
Line 55: 'myDataRow("Username") = CType(FileBase.Select(New DataSourceSelectArguments).GetEnumerator.Current, String)
Line 56: myDataRow("Username") = CType(FileBase.Select(New DataSourceSelectArguments()), String)
Line 57:
Line 58: filesTable.Rows.Add(myDataRow)Source File: D:YorZapdir_list_sort.aspx    Line: 56 Stack Trace: [InvalidCastException: Unable to cast object of type 'System.Data.DataView' to type 'System.String'.]
ASP.dir_list_sort_aspx.BindFileDataToGrid(String strSortField) in D:YorZapdir_list_sort.aspx:56
ASP.dir_list_sort_aspx.Page_Load(Object sender, EventArgs e) in D:YorZapdir_list_sort.aspx:7
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +13
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +45
System.Web.UI.Control.OnLoad(EventArgs e) +80
System.Web.UI.Control.LoadRecursive() +49
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3743
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210 Please help me!

View 3 Replies View Related

Two Stored Procedures On Page_load?

Mar 6, 2008

Hi i have two stored procedures that need to run on page load, how will i go about doing this, thank you. Here is my code;protected void Page_Load(object sender, EventArgs e)
{if (!IsPostBack)
{SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["streamConnectionString"].ConnectionString);
SqlCommand command = new SqlCommand("retrieve_Articles", conn);command.CommandType = CommandType.StoredProcedure;
conn.Open();SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
ArticleList1.DataSource = reader;
ArticleList1.DataBind();
reader.Close();
}
}
The above loads up the article datagrid, how can i now load up my news section which has the following code;SqlConnection conn2 = new SqlConnection(ConfigurationManager.ConnectionStrings["streamConnectionString"].ConnectionString);
SqlCommand command2 = new SqlCommand("retrieve_News", conn);command2.CommandType = CommandType.StoredProcedure;
conn.Open();SqlDataReader reader2 = command.ExecuteReader(CommandBehavior.CloseConnection);
NewsList1.DataSource = reader2;
NewsList1.DataBind();
reader.Close();
}

View 7 Replies View Related

SSRS And Setting ID On Page_Load

Aug 27, 2007

I'm looking for a way to set the id (on an asp page) when a selected row from a SSRS report in clicked. The id set would then become a session parameter on said asp page.

View 1 Replies View Related

Is It Possible To Use Twice Declared. Variable Names- KILL And After Declared. Variable

May 1, 2008

is it possible to use twice declared. Variable names-
declared. Variable and after KILL
and use the same declared. Variable
like

DECLARE

@StartDate datetime

KILL @StartDate datetime (remove from memory)
use after with the same name

i have 2 big stored PROCEDURE
i need to put one after one
and psss only 1 Variable name to the second stored PROCEDURE
like this i don't get this error


The variable name '@Start_Date' has already been declared. Variable names must be unique within a query batch or stored procedure.

Msg 134, Level 15, State 1, Line 146

The variable name '@End_Date' has already been declared. Variable names must be unique within a query batch or stored procedure.
i use like
KILL @endDate ??
KILL @StartDate ??


TNX

View 12 Replies View Related

Procedure Or Function Sp_AddDealer Has Too Many Arguments Specified (error Via SqlDataSource)

Apr 9, 2007

Procedure or function sp_AddDealer has too many arguments specified.
I am experiencing the 'too many arguments specified' error.  I am running on SQL 2005.  The Parameters lists on SQL server (when I view a dropdown under the sp name) shows a 'returns integer'  (but without the @ the signifies a parameter).I have looked around the forums and haven't seen quite this flavor of this error.  My forehead is sore from beating it against the wall... any clue would be appreciated!
The error occurs when I click the 'new' link button, enter some data and then click the update link button after ... BOOM - Procedure or function sp_AddDealer has too many arguments specified.
Thanks!!
Chip Kigar
Here is the stored Procedure:

set ANSI_NULLS ONset QUOTED_IDENTIFIER ONgo
ALTER PROCEDURE [dbo].[sp_AddDealer]  @sCarcareSystem varchar(100), @sDealerName varchar(50), @sDealerPhysAddrStreet varchar(200), @sDealerPhysAddrCity varchar(100), @sDealerPhysAddrState varchar(10), @sDealerPhysAddrZip varchar(20), @nReturnCode bigint output, @nReturnId bigint output AS
 SET NOCOUNT ON  DECLARE @m_nCt bigint  SET @nReturnCode = 0 SET @nReturnId = 0
 -- VALIDATE IF (@nReturnCode = 0) BEGIN  SELECT   @m_nCt = COUNT(tblDealers.[_DealerId])   FROM    tblDealers    WHERE   [Dealer Name] = @sDealerName   IF (@m_nCt >0)  BEGIN   SET @nReturnCode = -2000 --'Error for exsiting Dealer'   SET @nReturnId = 0  END END
 -- PROCESS IF (@nReturnCode = 0) BEGIN  SET @nReturnCode = -2 --' Error getting new record id'  DECLARE @m_nNewRecId bigint  SET @m_nNewRecId = 0  EXEC sp_GetNewRecId @m_nNewRecId output  IF (@m_nNewRecId > 0)  BEGIN   SET @nReturnCode = -1 --'Error adding Dealer'   INSERT INTO     tblDealers    (    [_DealerId],    [Carcare System],    [Dealer Name],    [Dealer Phys Addr Street],    [Dealer Phys Addr City],    [Dealer Phys Addr State],    [Dealer Phys Addr Zip]    )    VALUES    (    @m_nNewRecId,    @sCarcareSystem,    @sDealerName,    @sDealerPhysAddrStreet,    @sDealerPhysAddrCity,    @sDealerPhysAddrState,    @sDealerPhysAddrZip    )    SET @nReturnCode = 0 --'Success'   SET @nReturnId = @m_nNewRecId
   END  END
 
Here is the SQLDataSource.  I plugged the ID parameter, so I got a schema back, but no data.


    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"        InsertCommand="sp_AddDealer" InsertCommandType="StoredProcedure"         SelectCommand="sp_GetDealerByDealerId"   SelectCommandType="StoredProcedure">        <SelectParameters>            <asp:Parameter DefaultValue="2" Name="nDealerId" Type="Int64" />            <asp:Parameter DefaultValue="" Direction="Output" Name="nReturnCode" Type="Int64" />            <asp:Parameter Direction="Output" Name="nReturnId" Type="Int64" />        </SelectParameters>        <InsertParameters>            <asp:Parameter Name="sCarcareSystem" Type="String" />            <asp:Parameter Name="sDealerName" Type="String" />            <asp:Parameter Name="sDealerPhysAddrStreet" Type="String" />            <asp:Parameter Name="sDealerPhysAddrCity" Type="String" />            <asp:Parameter Name="sDealerPhysAddrState" Type="String" />            <asp:Parameter Name="sDealerPhysAddrZip" Type="String" />            <asp:Parameter Direction="InputOutput" Name="nReturnCode" Type="Int64" />            <asp:Parameter Direction="InputOutput" Name="nReturnId" Type="Int64" />        </InsertParameters>    </asp:SqlDataSource>
Here is the Formview:

    <asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1">        <EditItemTemplate>            _DealerId:            <asp:TextBox ID="_DealerIdTextBox" runat="server" Text='<%# Bind("_DealerId") %>'>            </asp:TextBox><br />            Carcare System:            <asp:TextBox ID="Carcare_SystemTextBox" runat="server" Text='<%# Bind("[Carcare System]") %>'>            </asp:TextBox><br />            Dealer Name:            <asp:TextBox ID="Dealer_NameTextBox" runat="server" Text='<%# Bind("[Dealer Name]") %>'>            </asp:TextBox><br />            Address Street:            <asp:TextBox ID="Address_StreetTextBox" runat="server" Text='<%# Bind("[Address Street]") %>'>            </asp:TextBox><br />            Address City:            <asp:TextBox ID="Address_CityTextBox" runat="server" Text='<%# Bind("[Address City]") %>'>            </asp:TextBox><br />            Address State:            <asp:TextBox ID="Address_StateTextBox" runat="server" Text='<%# Bind("[Address State]") %>'>            </asp:TextBox><br />            Address Zip:            <asp:TextBox ID="Address_ZipTextBox" runat="server" Text='<%# Bind("[Address Zip]") %>'>            </asp:TextBox><br />            <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"                Text="Update">            </asp:LinkButton>            <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"                Text="Cancel">            </asp:LinkButton>        </EditItemTemplate>        <InsertItemTemplate>            _DealerId:            <asp:TextBox ID="_DealerIdTextBox" runat="server" Text='<%# Bind("_DealerId") %>'>            </asp:TextBox><br />            Carcare System:            <asp:TextBox ID="Carcare_SystemTextBox" runat="server" Text='<%# Bind("[Carcare System]") %>'>            </asp:TextBox><br />            Dealer Name:            <asp:TextBox ID="Dealer_NameTextBox" runat="server" Text='<%# Bind("[Dealer Name]") %>'>            </asp:TextBox><br />            Address Street:            <asp:TextBox ID="Address_StreetTextBox" runat="server" Text='<%# Bind("[Address Street]") %>'>            </asp:TextBox><br />            Address City:            <asp:TextBox ID="Address_CityTextBox" runat="server" Text='<%# Bind("[Address City]") %>'>            </asp:TextBox><br />            Address State:            <asp:TextBox ID="Address_StateTextBox" runat="server" Text='<%# Bind("[Address State]") %>'>            </asp:TextBox><br />            Address Zip:            <asp:TextBox ID="Address_ZipTextBox" runat="server" Text='<%# Bind("[Address Zip]") %>'>            </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>            _DealerId:            <asp:Label ID="_DealerIdLabel" runat="server" Text='<%# Bind("_DealerId") %>'>            </asp:Label><br />            Carcare System:            <asp:Label ID="Carcare_SystemLabel" runat="server" Text='<%# Bind("[Carcare System]") %>'>            </asp:Label><br />            Dealer Name:            <asp:Label ID="Dealer_NameLabel" runat="server" Text='<%# Bind("[Dealer Name]") %>'>            </asp:Label><br />            Address Street:            <asp:Label ID="Address_StreetLabel" runat="server" Text='<%# Bind("[Address Street]") %>'>            </asp:Label><br />            Address City:            <asp:Label ID="Address_CityLabel" runat="server" Text='<%# Bind("[Address City]") %>'>            </asp:Label><br />            Address State:            <asp:Label ID="Address_StateLabel" runat="server" Text='<%# Bind("[Address State]") %>'>            </asp:Label><br />            Address Zip:            <asp:Label ID="Address_ZipLabel" runat="server" Text='<%# Bind("[Address Zip]") %>'>            </asp:Label><br />            <asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New"                Text="New">            </asp:LinkButton>        </ItemTemplate>    </asp:FormView>

View 4 Replies View Related

How Do I .. Use A Dataview To Break Up Sqldatareader ? Please Help!

Feb 8, 2006

Hello,
I am using a sqldatareader to get back a whole set of data.
The columns are id, data_id and data_desc
for example, the collection is id   data_id   data_desc0    100       this is name for id 00    101       this is address for id 00    102       this is gender for id 01    100       this is name for id 11    101       this is address for id 11    102       this is gender for id 12    100       this is name for id 22    101       this is address for id 22    102       this is gender for id 23    100       this is name for id 33    101       this is address for id 33    102       this is gender for id 3
I want to be able to go thru' this list and break up for each id and create a txt file. So, i will have four text files.
txt0.txt will contain100, this is name for id 0 101, this is address for id 0102, this is gender for id 0
I would like to know, how do i use a dataview to break up the sqldatareader so i can then repeat the loop for each id and generate the text file.
I don't have a problem generating the text file.
Please let me know, how should i go about it.
Thanks a bunch,-Sean
 

View 1 Replies View Related

Setting The SQL For A Dataview At Runtime.

Apr 18, 2006

I don't know if this topic should go in this forum category or in the SQLDataSource forum.
I need to be able to provide SQL which varies based on what the user enters on a page.  However, this isn't as simple a providing parameters in the SQLDataSource control because the SQL changes depending on what the user selects.  For example, in a customer search page, they choose to search by either first name or last name from a drop down list and then enter the name to search for in a text box.  The dataview should display the matching customers.
How can I set this SQL based on the entered values while also keeping the paging and sorting capabilities of the dataview?  You don't seem to be able to set the SQL for an SQLDataSource at run time.

View 3 Replies View Related

Query In Dataview.rowfilter

Jul 23, 2005

In the dataview rowfilter property, how can I say that I just wantTitles that start with 'A' to 'J' ??ex:dv.rowfilter = " Country = ' France ' "I wantdv.rowfilter = " Title = (from 'A' to 'J') "This doesn't work :dv.rowfilter = " Title like '[a-j]%' "Neither does :dv.rowfilter = " Title like 'a%'" AND "Title like 'b%'" AND..so onBut this does work just for the Titles starting with 'a'dv.rowfilter = " Title like 'a%' "any idea ?JMT

View 2 Replies View Related

How To Bind TextBox Controls To DataView ?

Jun 11, 2006

Hi,
I use a filter on a dataview which has uniq rows. I need to bind several fields of the result filtered row to textboxes. Here the code :
protected void Page_Load(object sender, EventArgs e)    {        string id = Request.QueryString["id"];
        if (PreviousPage != null)        {            SqlDataSource dsPrev = (SqlDataSource)PreviousPage.FindControl("SqlDataSource1");
            DataView dv = (DataView)(dsPrev.Select(DataSourceSelectArguments.Empty));            dv.RowFilter = "dr_id='" + id + "' ";            dv.RowStateFilter = DataViewRowState.CurrentRows;
            txtFirstName.Text = // ???  FirstName Field
            txtLastName.Text= // ???  LastName Field
            txtAddress.Text=  // ???  Address Field                               }    }
   I don't know which cod to put in those lines.
   On the help of the dataView there is an example that use DataBindings. This example is in the DataView.RowFilter article:
Text1.DataBindings.Add("Text",view,"CompanyName");
The big problem is that I don't have a method or event call 'DataBindings'. I just have 'DataBind' method or dataBinding event and they both don't support the 'Add' method.
So how can I bound those controls to my filtered Dataview field value.
Thanks,
David

View 3 Replies View Related

Query In Dataview/update Form

Dec 23, 2006

Question related to Visual Basic Video Lesson 09 (Databinding.wmv) by Bob Tabor.

Made a table and a UI form according to this lesson (table colums: CustomerID, FirstName, LastName).

Is it possible to use the same or an identical looking query form to find "Bob" by typing Bob in the Fist Name textbox or "Tabor" by typing Tabor in the Last Name textbox as in FileMaker?

Thanks,

View 4 Replies View Related

How To Use MDX Script In RS Dimension Filter (dataview)

Mar 23, 2007

Hi, I need to create filter which retrieves data for current moment. [time].[date].lastchild is not an option because the calender in database is generated till following year (2008).

I guess script goes like..

[time].[date].currentmember

but it does not work.


I'm green with these MDX scripts.. I'd be very pleased if some one of you gurus could help me.

Best Regards,
Eeva

View 1 Replies View Related

Cannot Convert Type 'int' To 'System.Data.DataView'

Feb 2, 2008

I have the following SqlDataSource in my page:<asp:SqlDataSource ID="sqlds" runat="server" ConnectionString="<%$ ConnectionStrings:cs %>"    SelectCommand="SELECT [Quest1], [Quest2], [Quest3], [Quest4], [Quest5] WHERE ([QuestID] = @QuestID)">    <SelectParameters>        <asp:Parameter Name="QuestID" />    </SelectParameters> In my code I get the following error: "Cannot convert type 'int' to 'System.Data.DataView'", I don't understand why I am getting this error because I am casting my SqlDataSource as type DataView when passing it to my DataView type.Code: protected void Chart(string record)    {        System.Data.DataView dv = (System.Data.DataView)sqlds.SelectParameters.Add("QuestID", System.TypeCode.Int32, record); //Error line       ...       ...       ...}If anyone could point me in the right direction I would be very grateful. 

View 5 Replies View Related

Compilation Error

Sep 30, 2004

I'm trying to connect to an SQL database through my asp.net page and I'm getting an Compiler Error Message: BC30188: Declaration expected for the following codes:

DBConn= New OledbConnection("Provider=sqloledb;" _

DBInsert.Commandtext = "Insert Into GuestInfo" _

DBInsert.Connection =DBConn

DBInsert.Connection.Open

DBInsert ExecuteNonQuery()

What I'm trying to do is connect to the SQL database and input new information to the database.

This is the entire code for connecting and entering info into the database. The SQL Database's name is HMS. I'm stuck and I can't figure it out.

Dim DBConn as oledbConnection
Dim DBInsert As New oledbCommand
DBConn= New OledbConnection("Provider=sqloledb;" _
& "server=localhost;" _
& "Initial Catalog=HMS;" _
& "User id=sa;" _
& "Password=yourpassword;")
DBInsert.Commandtext = "Insert Into GuestInfo" _
& "(FirstName,Lastname,Address,City,State,Zipcode) values ('" _
&"'" & txtFirstName.Text & "', " _
&"'" & txtLastName.Text & "', " _
&"'" & txtAddress.Text & "', " _
&"'" & txtCity.Text &"', " _
&"'" & txtState.Text &"', " _
&"'" & txtZipCode.Text &"', ")"
DBInsert.Connection =DBConn
DBInsert.Connection.Open
DBInsert ExecuteNonQuery()

View 3 Replies View Related

SP Compilation Time

Jan 28, 2014

SP is taking more time for compilation.SP has 30 update statement all are using indexed column in where clause.how can i force SP to take less compilation time.

View 5 Replies View Related

Prevent SP Compilation

Jul 20, 2005

Hi,I'm using SQL Server 2000 MSDE on a laptop running Windows XP.I have a couple of SP's that that quite some time to compile. So I waswondering: is there any way to have the database *not* recompile them everytime after a reboot?BOL says: "As a database is changed by such actions as adding indexes orchanging data in indexed columns, the original query plans used to accessits tables should be optimized again by recompiling them. This optimizationhappens automatically the first time a stored procedure is run afterMicrosoft® SQL ServerT 2000 is restarted."Now the SQL Server is restarted a lot, because laptops don't have endlessbatteries <g>Cheers,Bas

View 3 Replies View Related

Avoiding Compilation

Jul 20, 2005

Using small stored procs or sp_executesql dramatically reduces the number ofrecompiles and increases the reuse of execution plans. This is evident fromboth the usecount in syscacheobjects, perfmon, and profiler. However I'm ata loss to determine what causes a compilation. Under rare circumstances theusecount for Compiled Plan does not increase as statements are run. Seemsto correspond to when there is no execution plan. It would seem to me thatcompilation is a resource intensive task that if possible (data and schemaare not changing) should be held to a minimum.How does one encourage the reuse of compile plans?Is this the same as minimizing compilation?Looks like some of this behavior is changing in SQL 2005....Thanks,Danny

View 3 Replies View Related

How To Access Underlaying DataView Of SQLDataSouce In It's Selected Event

Jun 30, 2006

I need access to the underlying DataView associated with a declaratively defined SQLDataSource. Ideally, I need this access in the SQLDataSource's Selected event. I know that I can use the SQLDataSouce.Select() method to return the underlying DataView object. But, there is a GridView control bound to the datasource so I don't want to explicity call Select() since it will end up being called again implicity by the gridview itself. I have seen that this can be done with an ObjectDataSouce as follows:
void odsDataSouce_Selected(object sender, ObjectDataSourceStatusEventArgs e) {  DataView oDV = (DataView)e.ReturnValue;}
Is there any way to accomplish the same thing with a SQLDataSouce?  It seems hard to believe that the query results are not exposed to the Selected event.
Thanks!
 
 

View 4 Replies View Related

Bulk Update Of All Changes From DataView To DataSet (only Opening Connection Once)?

Feb 15, 2008

(Hope this isn't a "stupid" question, but I haven't been able to find a straight-forward answer anywhere)"
I currently have code that iterates through a dataview's records, making a change to a field in some of the records. The way I have this coded, a conection has to opened & closed for each individual record that's updated:
    dsrcUserIae.UpdateCommand = "UPDATE UserIAE SET blnCorrect = @blnCorrect WHERE (ID = @ID)"    dsrcUserIae.UpdateParameters.Add("blnCorrect", SqlDbType.Bit)    dsrcUserIae.UpdateParameters.Add("ID", SqlDbType.Int)
    Dim myDataView As DataView = CType(dsrcUserIae.Select(DataSourceSelectArguments.Empty), DataView)         For Each myRow As DataRowView In myDataView       If myRow("FkUsersAnswerID") = myRow("AnswerID") Then         intCorrect = 1       Else         intCorrect = 0       End If       dsrcUserIae.UpdateParameters.Item("blnCorrect").DefaultValue = intCorrect       dsrcUserIae.UpdateParameters.Item("ID").DefaultValue = myRow("ID")       intUpdateResult = dsrcUserIae.Update()    Next
It seems like I should be able to do something like this (call update once), but I'm not sure how... 
    dsrcUserIae.UpdateCommand = "UPDATE UserIAE SET blnCorrect = @blnCorrect WHERE (ID = @ID)"    dsrcUserIae.UpdateParameters.Add("blnCorrect", SqlDbType.Bit)    dsrcUserIae.UpdateParameters.Add("ID", SqlDbType.Int)
    Dim myDataView As DataView = CType(dsrcUserIae.Select(DataSourceSelectArguments.Empty), DataView)            For Each myRow As DataRowView In myDataView      If myRow("FkUsersAnswerID") = myRow("AnswerID") Then        myRow("blnCorrect") = 1      Else        myRow("blnCorrect") = False      End If    Next
      intUpdateResult = dsrcUserIae.Update() 'Want all changed myRow("blnCorrect") to be updated to datasource
Can anybody explain how to do the bulk update? I've seen some info about AcceptChanges and Merge, but I'm not sure if they apply here, or if they more for Transactions.

View 1 Replies View Related

Compilation / Re-build Issue

May 5, 2008


Hi,
We are using .Net 2.0 for developing our application, All the file in this application are source safed, Whenever we do modification in the code it take longer time to build approax it takes around 2 min to display the default page (login page).

Please do send out your suggestions to reduce the time take for the build, is there any setting need to be done in IDE to make the build process much faster.

Regards
K.Karthik Doss

View 1 Replies View Related

Compilation Of Stored Procs

Aug 10, 2006

Hi,

I would like to know if the execution plans of stored procs also get migrated when we do migration to 2005 from 2000 using attachdetach method or we will need to re-run the stored procs?

The thing is when I am running the Stored procs in 2005, its performing really slow in first run.

Any help in his regard is highly appreciated.

Thanks,
Ritesh









View 1 Replies View Related

SP Compilation Confirmation Message?

Nov 13, 2006

How can we say whether the SP is successfully compiled or not if we are compiling it on the server as a part of the TSQL script since it does not throw any message like ORACLE does.

In oracle, system will let you know whether the the procedure is successfully complied or not?

Thanks/

View 6 Replies View Related

SQL Compilation And Execution Plan

Jul 5, 2007

Hi all,

I€™m having a test regarding to the image data type. The test program is written with sql native api and just update the image data type column, but I looked the SQL Compilations/sec and Batch Requests/sec counters in SQLServer:QL Statistics using Perfmon, both values are almost the same. It seemed whenever the stored procedure is called, SQLServer compiles it and makes execution plan again. But when I had a test without image data type, SQL Compilation/sec was 0. SQL version is Microsoft SQL Server 2005 - 9.00.3054.00 (Intel X86) (Build 2600: Service Pack 2).

Is SQL server working the way expected or am I missing something?

View 1 Replies View Related

Compilation Error On Store Procedure

Oct 24, 2005

Hi all,Here is my error: Server: Msg 245, Level 16, State 1, Procedure NewAcctTypeSP, Line 10Syntax error converting the varchar value 'The account type is already exist' to a column of data type int.Here is my procedure:ALTER PROC NewAcctTypeSP(@acctType VARCHAR(20), @message VARCHAR (40) OUT)ASBEGIN  --checks if the new account type is already exist IF EXISTS (SELECT * FROM AcctTypeCatalog WHERE acctType = @acctType) BEGIN  SET @message = 'The account type is already exist'  RETURN @message END
 BEGIN TRANSACTION  INSERT INTO AcctTypeCatalog (acctType) VALUES (@acctType)  --if there is an error on the insertion, rolls back the transaction; otherwise, commits the transaction  IF @@error <> 0 OR @@rowcount <> 1   BEGIN    ROLLBACK TRANSACTION    SET @message = 'Insertion failure on AcctTypeCatalog table.'    RETURN @message       END  ELSE    BEGIN        COMMIT TRANSACTION   END
 RETURN @@ROWCOUNTENDGO
--execute the procedureDECLARE @message VARCHAR (40);EXEC NewAcctTypeSP 'CDs', @message;I am not quite sure where I got a type converting error in my code and anyone can help me solve it???(p.s. I want to return the @message value to my .aspx page)Thanks.

View 9 Replies View Related

C++ Ole DB Stack Overflow During Sql Server Compilation

Jul 20, 2005

hi,when i execute :CCommand<CManualAccessor, CBulkRowset, CNoMultipleResults> rs;rs.SetRows(100);HRESULT code_resultat = rs.Open(session, requete, &propset, NULL,DBGUID_DBSQL, FALSE);with a requete with length = 13000, it works perfectlybut when my requete length is 200000 (example : SELECT * FROM myTABLEWHERE id_table IN("lot of number : more then 30000 number"))i have code_resultat = DB_E_ERRORSINCOMMAND (= 0x80040e14)and when i explore the IErrorInfo message, i have :minor = 565 and the message issource :Microsoft OLE DB Provider for SQL Serverserveur has made a stack overflow during compilation...Is there a solution to extract to data ?in a fast way ...thanks in advance ...Mike

View 1 Replies View Related

SSIS Package Compilation And Execution

Mar 6, 2007

I am wondering something, once we've created a job that executes a package at a given time interval, does that package get recompiled each time the job spins up and executes the package? Or is the package compiled once and then that compiled code is executed each run after the first run?

What I'm seein is this; I have a package that reads data from flat text files and then dumps that data into the database. The package will take 3 minutes to execute when executing on a single file, but when it's looping through ~50 files, it will take ~30 minutes to execute, that is less than a minute per file. Why is this?

Hopefully I'm just forgetting something and not setting a checkbox or radio button somewhere. The job is set up as an SSIS job, not as a command line job.

Thanks in advance for any help you can give me.

Wayne E. Pfeffer
Sr. Systems Analyst
Hutchinson Technolgy Inc.

View 1 Replies View Related

Delaying Compilation Real Time

Nov 29, 2006

Hi,
I would like to find out about SSIS compilation. Can you mention anything regarding this issue or can you point me out to a website for this topic please?

Thanks

View 1 Replies View Related

Newbie With An Easy Compilation Error Question.

Dec 30, 2003

I've been looking over this and can't see anything wrong. Can anyone shed some light on this for me?
------------------

Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0117: 'System.Data.SqlClient.SqlConnection' does not contain a definition for 'ExecuteReader'

Source Error:



Line 16: SqlCommand myComm = new SqlCommand("SELECT users, password FROM users WHERE username='" + username + "' AND password='" + password + "'", myConn);
Line 17: myConn.Open();
Line 18: SqlDataReader myReader = myConn.ExecuteReader();
Line 19: do
Line 20: {


Source File: D:Inetpubhoteladvisor estLogin.aspx Line: 18


void Login(string username, string password)
{
SqlConnection myConn = new SqlConnection ("server = client1; uid = dbadmin; pwd = dbadmin; database = hotels");
SqlCommand myComm = new SqlCommand("SELECT users, password FROM users WHERE username='" + username + "' AND password='" + password + "'", myConn);
myConn.Open();
SqlDataReader myReader = myConn.ExecuteReader();
do
{
while (reader.Read())
{
if (username == myReader.GetString(1) && password == myReader.GetString(2))
{
messages.Text = "Your login was successful!";
}
else
{
messages.Text = " Your login was unsuccessful!";
}
}
}
while (reader.NextResult());
myReader.Close();
myConn.Close();
}
void Submit_Click(Object sender, EventArgs e)
{
Login(username.Text, password.Text);
}


Edit by moderator - NetProfit: Added < code>< /code> tags.

View 7 Replies View Related

DTS To SSIS Conversion (ActiveX Script Has Compilation Errors)

Oct 12, 2015

I am re-writing old DTS packages(from sql 2005) to convert them to SSIS packages(sql 2014) and in one of the script task, the old activex script does not run.

The script is :

'************************
' Visual Basic ActiveX Script
'************************
Function Main()
mydate = now()
yrs = ""
mth = ""
mth = Month(mydate) - 1
yrs = Right(Year(mydate), 4)
If Month(mydate) = 1 Then mth = "12"

[code].....

Not sure how to proceed forward? I am quite new to package migration

View 0 Replies View Related







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