Returning HTML Via SQL To Bind To A Gridview

Apr 14, 2008



So I have a stored procedure that returns rows that look similer to this


<a href="~/Manage/ManageVersion.aspx?viewstate=MTgwNywzMTc0LDguOSAgICAgICA=">DPF-13</a>

Unfortunatly when it is bound to the gridview it seems to convert the value to HTML safe.

The value it prints on the page is


&lt;a href=&quot;~/Manage/ManageVersion.aspx?viewstate=MTgwNywzMTc0LDguOSAgICAgICA=&quot;&gt;DPF-13&lt;/a&gt;



Hit quote to look at the actual values


How can I fix the output to the gridview to print the actual link and the the html safe value?

Can I accomplish this in SQL or am I going to have to do it all in the c# code (which will be a less clean solution and alot more work).


tia

View 2 Replies


ADVERTISEMENT

Returning HTML Via SQL

Apr 14, 2008

So I have a stored procedure that returns rows that look similer to this


Code:


<a href="~/Manage/ManageVersion.aspx?viewstate=MTgwNywzMTc0LDguOSAgICAgICA=">DPF-13</a>


Unfortunatly when it is bound to the gridview it seems to convert the value to HTML safe.

The value it prints on the page is


Code:


<a href="~/Manage/ManageVersion.aspx?viewstate=MTgwNywzMTc0LDguOSAgICAgICA=">DPF-13</a>



Hit quote to look at the actual values

How can I fix the output to the gridview to print the actual link and the the html safe value?

Can I accomplish this in SQL or am I going to have to do it all in the c# code (which will be a less clean solution and alot more work).


tia

View 1 Replies View Related

Searching SQL Db And Returning Results To Gridview

Jan 29, 2008

Hello....
I am in the process of building a search function for an application (VS2005, ASP.net, VB code, and AJAX functionality).The user's form has a textbox (for an input string) and two drop-downs.  The user would then click on a "Search Now" button, and the data should populatein a Gridview to the left of the search form.  I'm trying to search over an SQL database and need to know how to exactly implement what I have so far:
<div id="mcb" style="background-color:#2e4b5b; width:195px; height:410px; float:left">     <div id="ht" style="background-color:#1b2c36;padding:10px; border-bottom:solid 1px #fffdff; width:175px;float:left;">           Quick Search      </div><div style="clear:both;"></div>
<div style="padding:10px; background-color:#2e4b5b">      <div id="tfta" style="padding:5px 0px 0px 0px">                <b>Vendor Name</b>                <asp:TextBox ID="txtVendorFilter" runat="server"></asp:TextBox>                <div style="font-size:1px; width:150px; height:1px; background-color:#8FA71F"></div><br />                 <b>Contract Type:</b>                 <asp:dropdownlist ID="ddlContractTypeSearch" runat="server" Width="155px">                           <asp:ListItem Value="0">Select...</asp:ListItem>                           <asp:ListItem Value="1">Vendor Maintenance</asp:ListItem>                           <asp:ListItem Value="2">Consulting Contract</asp:ListItem>                           <asp:ListItem Value="3">Hardware License</asp:ListItem>                           <asp:ListItem Value="4">Software License</asp:ListItem>                           <asp:ListItem Value="5">Statement of Work</asp:ListItem>                           <asp:ListItem Value="6">Admin Svcs. Agreement</asp:ListItem>                           <asp:ListItem Value="7">Master Service Agreement</asp:ListItem>                  </asp:dropdownlist>
           <div style="font-size:1px; width:150px; height:1px; background-color:#8FA71F"></div><br />                   <b>Sort By:</b>                   <asp:DropDownList ID="ddlSortBy" runat="server" Width="155px">                          <asp:ListItem Value="0">Select...</asp:ListItem>                          <asp:ListItem Value="1">Contract Name</asp:ListItem>                          <asp:ListItem Value="2">Contract Type</asp:ListItem>                    </asp:DropDownList>             <div style="font-size:1px; width:150px; height:1px; background-color:#8FA71F"></div><br />        </div>    <br />    <asp:Button ID="btnUpdateFilter" runat="server" Text="Search" width="120px"/>    <asp:Button ID="btnReset" runat="server" Text="Reset" /></div>
</div>
 Here's my select statement used to initially populate the Gridview (set up using the configuration of the Gridview):SELECT [ContractID], [ContractName], [ContractType], [EffectiveDate], [TerminationDate] FROM [Contract]Here's my btnUpdateFilter codebehind (VB):
Protected Sub btnUpdateFilter_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpdateFilter.Click     Dim strVendorName As String     Dim strContractType As String     Dim strSortBy As String     If txtVendorFilter IsNot "" Then           strVendorName = txtVendorFilter.Text     End If
''''''''''''''''''''''''''''If ddlContractTypeSearch.SelectedValue = 1 Then      strContractType = "1"ElseIf ddlContractTypeSearch.SelectedValue = 2 Then      strContractType = "2"ElseIf ddlContractTypeSearch.SelectedValue = 3 Then      strContractType = "3"ElseIf ddlContractTypeSearch.SelectedValue = 4 Then      strContractType = "4"ElseIf ddlContractTypeSearch.SelectedValue = 5 Then      strContractType = "5"ElseIf ddlContractTypeSearch.SelectedValue = 6 Then      strContractType = "6"ElseIf ddlContractTypeSearch.SelectedValue = 7 Then      strContractType = "7"Else      strContractType = "0"End If
''''''''''''''''''''''''''''''If ddlSortBy.SelectedValue = 1 Then     strSortBy = "ContractName"ElseIf ddlSortBy.SelectedValue = 2 Then     strSortBy = "ContractType"Else     strSortBy = "ContractName"End If
End Sub
 
My question is, "how can I form the proper SQL statement", and then implement it so that my gridview will populate using my generated SQL Statement?
Thank you for the help!!!
-S

View 1 Replies View Related

Want Error Message To Appear When No Database Results Were Returned In GridView, Also Other GridView Issues.

Jun 12, 2008

Hi, I am seeking a hopefully easy solution to spit back an error message when a user receives no results from a SQL server db with no results. My code looks like this What is in bold is the relevant subroutine for this problem I'm having.   Partial Class collegedb_Default Inherits System.Web.UI.Page Protected Sub submit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles submit.Click SqlDataSource1.SelectCommand = "SELECT * FROM [college_db] WHERE [name] like '%" & textbox1.Text & "%'" SqlDataSource1.DataBind() If (SqlDataSource1 = System.DBNull) Then no_match.Text = "Your search returned no results, try looking manually." End If End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load SqlDataSource1.SelectCommand = "SELECT * FROM [college_db] ORDER BY [name]" SqlDataSource1.DataBind() End Sub Protected Sub reset_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles reset.Click SqlDataSource1.SelectCommand = "SELECT * FROM [college_db] ORDER BY [name]" SqlDataSource1.DataBind() End SubEnd Class  I'm probably doing this completely wrong, I'm a .net newb. Any help would be appreciated. Basically I have GridView spitting out info from a db upon Page Load, but i also have a search bar above that. The search function works, but when it returns nothing, I want an error message to be displayed. I have a label setup called "no_match" but I'm getting compiler errors. Also, next to the submit button, I also have another button (Protected sub reset) that I was hoping to be able to return all results back on the page, similar to if a user is just loading the page fresh. I'd think that my logic would be OK, by just repeating the source code from page_load, but that doens't work.The button just does nothing. One final question, unrelated. After I set this default.aspx page up, sorting by number on the bottom of gridview, ie. 1,2,3,4, etc, worked fine. But now that paging feature, as long with the sorting headers, don't work! I do notice on the status bar in the browser, that I receive an error that says, "error on page...and it referers to javascript:_doPostBack('GridView1, etc etc)...I have no clue why this happened. Any help would be appreciated, thanks! 

View 2 Replies View Related

Display HTML Codes As HTML And Not Text

Jan 15, 2008

I am retrieving a field from SQL and displaying that data on a web page.
The data contains a mixture of text and html codes, like this "<b>test</b>".
But rather than displaying the word test in bold, it is displaying the entire sting as text.
How do I get it to treat the HTML as HTML?

View 6 Replies View Related

How To Bind SQL Express To A Particular CPU?

Mar 15, 2006

Since SQL Express only runs on one CPU, is there a way to bind SQL Express to a particular CPU, or SQL Express only runs on CPU0?

And in case of CPU hyperthreading, I assume that the CPU SQL Express running on will be a logical CPU, not a physical CPU, am I right?

View 3 Replies View Related

Bind A Label To An SqlDataSource

Nov 22, 2006

Hi all,I would like to do something I thought was simple but I can't seem to figure it out. I would like to bind the Text properties to two labels to the columns in an SqlDataSource, much the same as you can bind a listbox to a SqlDataSource.Is this possible?The reason why I'm trying it this way is because I originally used an OleDB connection and datareader, but it doesn't seem to work on our service providers server (keeps saying that it can't find the database) even though it works on the four other server's I've tried. It definitely connects to the database when I use the SqlDataSource on a listbox control, but it fails when I use the same connection string with the OleDB connection.Is this the best way to go about it, or should I persist with finding the OleDB/datareader (the service provider has been no help at all). Thanks. 

View 1 Replies View Related

How Can I Bind To An SqlDataSource From Code

Feb 18, 2007

My code behind file builds a select statement and I would like to fill an SqlDataSource control with it. Can some show me an example of how I might do that? Maybe something like this?
Me.SqlDataSourceSearchResult.ConnectionString = "ConnectStr"
Me.SqlDataSourceSearchResult.SelectCommand = "SelectStatement"
gvSearchResult.DataSource = Me.SqlDataSourceSearchResult
gvSearchResult.DataBind()

View 5 Replies View Related

SQL2K Bind Failed

Jun 11, 2004

I tried to install SQL Server 2K on a W2K server running IIS and SSL. The SQL installation failed until I deleted the certs from my system. Now, the SQL logs say "SuperSocket Info: Bind failed on TCP port 1433". I have tried everything on the MS KB, TechNet, and MSDN sites that I could find. I have also uninstalled IIS and Certificate Services from the server. Since there are no certs left, I suspect that SQL Server is getting in it's own way on startup. Does anyone know of a way to trap/log this kind of conflict?

View 14 Replies View Related

How To Pass Value To Bind Variable

Jun 19, 2008

select field1 from table1 where field1 = @p_field1

Msg 137, Level 15, State 2, Line 1
Must declare the scalar variable "@p_field1".

Hi, i'm getting this error, could anybody please explain, how the syntax should be.........thanks

View 8 Replies View Related

Bind Variable In CURSOR

Mar 30, 2006

SQL Server 2000 SP4 with AWE hotfix. Windows 2003 SP1.I have a stored procedure which is not working the way I think itshould be.I have a CURSOR which has a variable in the WHERE clause:DECLARE get_tabs CURSOR local fast_forward FORSELECT distinct tablename, id, shcontig1dt, shcontig2dtFROM db_indWHERE dbname = @dbnameORDER BY tablenameIt won't return anything, even when I verify that @dbname has a valueand if I run the query in Query Analyzer with the value, it returnsrows:SELECT distinct tablename, id, shcontig1dt, shcontig2dtFROM db_indWHERE dbname = 'Archive'ORDER BY tablenameDB_Rpt_Fragmentation11575791622006-03-29 09:52:11.7772006-03-2909:52:11.823DtsAdtStdArchive_DataSourceType5175768822006-03-2909:52:11.8702006-03-29 09:52:11.887DtsADTstdArchiveNotUsed3575763122006-03-29 09:52:11.8872006-03-2909:52:12.103I've taken out most of the guts for simplicity, but here's what I'vegot:--CREATE TABLE dbo.db_ind--(--db_ind_tkintIDENTITY,-- id int NULL,-- tablename sysname NOT NULL,-- indid int NULL,-- indexname sysname NOT NULL,-- shcontig1dt datetime NULL,-- defragdt datetime NULL,-- shcontig2dt datetime NULL,-- reindexdt datetime NULL--)ALTER PROCEDURE IDR(@hours int)AS--SET NOCOUNT ON--SET ANSI_WARNINGS OFFDECLARE @tabname varchar(100),@indname varchar(100),@dbname varchar(50),@vsql varchar(1000),@v_hours varchar(4),@shcontig1dtdatetime,@shcontig2dtdatetime,@defragdtdatetime,@reindexdtdatetime,@idint,@indidint,@rundbcursorint,@runtabcursorint,@runindcursorintDECLARE get_dbs CURSOR local fast_forward FORSELECT dbnameFROM db_jobsWHERE idrdate < getdate() - 4or idrdate is nullORDER BY dbnameDECLARE get_tabs CURSOR local fast_forward FORSELECT distinct tablename, id, shcontig1dt, shcontig2dtFROM db_indWHERE dbname = @dbnameORDER BY tablenameDECLARE get_inds CURSOR local fast_forward FORSELECT indid, indexname, defragdt, reindexdtFROM db_indWHERE dbname = @dbnameAND tablename = @tabnameORDER BY indexnameOPEN get_dbsFETCH NEXT FROM get_dbsINTO @dbnameIF @@FETCH_STATUS = 0SELECT @rundbcursor = 1ELSESELECT @rundbcursor = 0SELECT @v_hours = CONVERT(varchar,@hours)--================================================== ================================================== =====--================================================== ================================================== =====--================================================== ================================================== =====WHILE @rundbcursor = 1BEGIN -- db whilePRINT '============================='PRINT @dbnamePRINT '============================='--================================================== ================================================== =====--================================================== ================================================== =====OPEN get_tabsFETCH NEXT FROM get_tabsINTO @tabname, @id, @shcontig1dt, @shcontig2dtIF @@FETCH_STATUS = 0BEGINPRINT 'table: ' + @tabnameSELECT @runtabcursor = 1endELSEBEGINPRINT 'not getting any tables! '-- <<<<< THIS IS WHERE IT HITSSELECT @runtabcursor = 0endWHILE @runtabcursor = 1BEGINPRINT @dbnamePRINT @tabname--================================================== ================================================== =====OPEN get_indsFETCH NEXT FROM get_indsINTO @indid, @indname, @defragdt, @reindexdtIF @@FETCH_STATUS = 0SELECT @runindcursor = 1ELSESELECT @runindcursor = 0WHILE @runindcursor = 1BEGINPRINT 'Index:' + @dbname + '.' + @tabname + '.' + @indnameFETCH NEXT FROM get_indsINTO @indid, @indname, @defragdt, @reindexdtIF @@FETCH_STATUS = 0SELECT @runindcursor = 1ELSESELECT @runindcursor = 0END-- 1st loop through indexesCLOSE get_inds--================================================== ================================================== =====--==========PRINT 'db.tab: ' + @dbname + '.' + @tabname--==========--================================================== ================================================== =====OPEN get_indsFETCH NEXT FROM get_indsINTO @indid, @indname, @defragdt, @reindexdtIF @@FETCH_STATUS = 0SELECT @runindcursor = 1ELSESELECT @runindcursor = 0WHILE @runindcursor = 1BEGINPRINT 'dbname: ' + @dbnamePRINT 'tabname: ' + @tabnamePRINT 'indname: ' + @indnameFETCH NEXT FROM get_indsINTO @indid, @indname, @defragdt, @reindexdtIF @@FETCH_STATUS = 0SELECT @runindcursor = 1ELSESELECT @runindcursor = 0END -- 2nd loop through indexesCLOSE get_inds--================================================== ================================================== =====FETCH NEXT FROM get_tabsINTO @tabname, @id, @shcontig1dt, @shcontig2dtIF @@FETCH_STATUS = 0SELECT @runtabcursor = 1ELSESELECT @runtabcursor = 0END-- loop through tablesCLOSE get_tabs--================================================== ================================================== =====--================================================== ================================================== =====PRINT 'Index Maintenence complete. Job report in[DB_Rpt_Fragmentation]'PRINT ''FETCH NEXT FROM get_dbsINTO @dbnameIF @@FETCH_STATUS = 0SELECT @rundbcursor = 1ELSESELECT @rundbcursor = 0END -- loop through databasesCLOSE get_dbsdeallocate get_dbsdeallocate get_tabsdeallocate get_inds--================================================== ================================================== =====--================================================== ================================================== =====--================================================== ================================================== =====GOAnd this is what I'm getting:=============================Archive=============================(0 row(s) affected)not getting any tables!Index Maintenence complete. Job report in [DB_Rpt_Fragmentation]......etc.Am I missing something obvious?Thank you for any help you can provide!!

View 1 Replies View Related

A SqlDataReader Is Returning An Int, When It Should Be Returning A Tinyint

Sep 25, 2007

I am opening a simple command against a view which joins 2 tables, so that I can return a column which is defined as a tinyint in one of the tables.  The SELECT looks like this:
 SELECT TreatmentStatus FROM vwReferralWithAdmissionDischarge WHERE ClientNumber = 138238 AND CaseNumber = 1 AND ProviderNumber = 89
 The TreatmentStatus column is a tinyint.  When I execute that above SQL SELECT statement in SQL Server Management Studio (I am using SQL Server 2005) I get a value of 2.  But when I execute the same SQL SELECT statement as a part of a SqlDataReader and SqlCommand, I get a return data type of integer and a value of 1.
Why?

View 5 Replies View Related

SQLDataSource No Bind On Page Load?

Aug 29, 2006

I use SQLDataSource, bind to a GridView and a SelectParameter that gets it's value from a textbox.  If the textbox is empty, then it returns all rows.How do I prevent the query and binding when the page first load?  Thanks

View 11 Replies View Related

How To Bind Data Retrived From Sql Db To DropDownLists?

Jun 20, 2007

 Hello all,I just have problems to bind the data to dropdownlists, and my code is written as:  SqlConnection myConnection;            SqlCommand myCommand;            SqlDataReader myReader;            myConnection = new SqlConnection();            myConnection.ConnectionString = ConfigurationManager.ConnectionStrings["NorthWindConnectionString"].ConnectionString;            myCommand = new SqlCommand();            myCommand.CommandText = "select PostalCode from Customers order by PostalCode asc";            myCommand.CommandType = CommandType.Text;            myCommand.Connection = myConnection;            myCommand.Connection.Open();            myReader = myCommand.ExecuteReader(CommandBehavior.CloseConnection);            DropDownList1.DataSource = myReader;            DropDownList1.DataBind();            myCommand.Dispose();            myConnection.Dispose();Any idea? Thanks 

View 3 Replies View Related

What All I Can Bind To My Select Query Results?

Nov 7, 2007

my question is what all can i bind my results of a select query to.i know we can use Dataset and Sqldatareader. can we use something else like hashtables. for example we can have:reader = cmd.ExecuteReader();  can we have something likeHashtable = cmd.ExecuteReader();

View 5 Replies View Related

How Do I Bind A Value Returned From Sqldatasource To A Session?

Apr 22, 2008

I have a sql data source that runs a query that returns a users data (See below).  I want to set the session variable "UserID" equal to the tkinit.  How do I "bind" the session to a column from this select command?   I tried this Session("UserID") = ("tkinit")    but that doesn't work.  I can hard code a session value, just can't figure out how to "bind" it from the sqldatasource.. 
<asp:SqlDataSource ID="getUserID" runat="server" ConnectionString="<%$ ConnectionStrings:xxxConnectionString %>" SelectCommand="SELECT [tkinit], [tklast], [tkfirst], [tkfirst]+' '+[tklast] as fullname FROM [yyy] WHERE ([login] = @login)"><SelectParameters><asp:Parameter Name="login" Type="String" /></SelectParameters></asp:SqlDataSource>
 
 

View 3 Replies View Related

Checkbox Changed Value Doesn't Bind

May 21, 2008

The following checkbox in my FormView only records "True" to the database, even after the checkbox is unchecked. After exhausting searches for many weeks, I'm in desperate need of a resolution and would very much appreciate your expertise. From what I understand, the #Bind feature is supposed to be a 2-way binding but I don't know why it doesn't work with my checkbox controls. I know that I should use AutoPostBack="True", but when I do so, I get the error "Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control."
<asp:UpdatePanel ID="udp1" UpdateMode="Conditional" runat="server">    <ContentTemplate>        <asp:CheckBox ID="chkEmail" Text="Display?" TextAlign="left"             Checked='<%#Bind("Email_Disp")%>' runat="server" /><br />    </ContentTemplate>  </asp:UpdatePanel> 
<asp:SqlDataSource ID="srcProfile" runat="server" ConnectionString="<%$ ConnectionStrings:webConn %>"
SelectCommand="sp_Profile_Get" SelectCommandType="StoredProcedure"
DeleteCommand="sp_Profile_Delete" DeleteCommandType="StoredProcedure"
UpdateCommand="sp_Profile_Update" UpdateCommandType="StoredProcedure">
<SelectParameters>
<asp:SessionParameter Name="UserID" SessionField="NewUserID" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="UserID" />
[snip]
<asp:Parameter Name="Email_Disp" Type="Boolean" />
[snip]
</UpdateParameters>
</asp:SqlDataSource>

---------From DB table: Email_Disp    bit---------
ALTER PROCEDURE dbo.sp_Profile_Get
@UserID uniqueidentifierAS SELECT *
FROM [myTable] WHERE UserID = CONVERT(uniqueidentifier,@UserID)
---------
ALTER PROCEDURE dbo.sp_Profile_Update            @UserID uniqueidentifier,[snip] @Email_Disp bit,[snip]
ASUPDATE [myTable] SET [snip], Email_Disp = @Email_Disp, [snip]WHERE UserID = CONVERT(uniqueidentifier,@UserID)

View 19 Replies View Related

Select Statements To Bind Datagrid

Apr 24, 2004

I want to select 2 fields from two tables inorder to bind my Datagrid...

How can I do that using SQL statement?

Possible to do that with one statement? or i need to create stored procedure?

Can anyone show me sample codes?

View 2 Replies View Related

Bind The Asp:SqlDataSource To A Label Control

Nov 12, 2005

how can i display the result of an  asp:SqlDataSource into a lable control.the sqldatasource returns the count for some thing ie "select count(*) as total from tbl"please help

View 1 Replies View Related

Bind 2 Tables From Different Database File.

Apr 23, 2006

Hi!

I have 2 databases. One is ASPNETDB.MDF and another is PPQ_Data.MDF
ASPNETDB.MDF is generated by ASP.net (VWD 2005) when I use Login control.
PPQ_Data.MDF is created by me. It contains menu and order information of my website.

I would like to connect this 2 databases together so that I can create
a GridView table that binds 2 tables, one from ASPNETDB.MDF and another
table from PPQ_Data.MDF. So, it is kind of displaying nested data.

Is there anybody out there that know how to connect 2 databases together?

Again, my purpose of connecting 2 databases together is to pull out a table from each database and bind the 2 tables together.

thanks in advanced for any advice or articles submitted.

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

Bind Variables / Parameter Queries

Jan 27, 2005

Hi,

I'm writing an Access pass-through query against a SQL server backend and I need some advice on passing parameters. Currently I use vba to substitute the literal values for the parameters prior to passing the query to SQL Server. However, I am going through a loop thousands of times with different literals for these parameters which causes the server's cache to fill up. In Oracle, there is a way to use bind variables for the parameters so that only one copy of the query is cached.

Does anyone know how I can do this in SQL Server?

For instance, I have 20,000 employees and I'm pulling info by SS#:

Select * from EmpTable where SS_number = [SSN]

Is there a way I can pass this query to SQL Server and then pass the value of [SSN] as I loop through the dataset?

Thanks.

View 5 Replies View Related

Does SQL Server Take Advantage Of 'bind Variables'

Jul 20, 2005

Using prepared statements like Oracle does? This way in a high transactionsystem you do not have to recompile queries every time?

View 3 Replies View Related

Dynamic Column Bind (Select * From..)

Jul 9, 2007

I'm looking for a way to use SSRS to display the contents of a returned dataset with 1-n columns. The number of columns is unknown at design time and the datasetview is using a stored procedure with 1 parameter to return the data. Does any one know if RDL supports wildcard(*) characters for field names or if there is another method.



I have this working via a web based custom aspx page but it would be VERY helpful to utilize all the document conversion features the SSRS reports provide via the web.



Thanks for any help.

IT Publisher

View 1 Replies View Related

Bind Object To RDLC Report

Apr 8, 2006

Hi,all
I hava a question about Bind object to RDLC Report,the RDLC like
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2005/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
  <DataSources>
    <DataSource Name="DummyDataSource">
      <ConnectionProperties>
        <ConnectString />
        <DataProvider>SQL</DataProvider>
      </ConnectionProperties>
      <rd:DataSourceID>47739726-cc8c-4719-b061-c392c2cceb68</rd:DataSourceID>
    </DataSource>
  </DataSources>
  <BottomMargin>2.5cm</BottomMargin>
  <RightMargin>2.5cm</RightMargin>
  <PageWidth>21cm</PageWidth>
  <rd:DrawGrid>true</rd:DrawGrid>
  <InteractiveWidth>21cm</InteractiveWidth>
  <rd:GridSpacing>0.25cm</rd:GridSpacing>
  <rd:SnapToGrid>true</rd:SnapToGrid>
  <Body>
    <ColumnSpacing>1cm</ColumnSpacing>
    <ReportItems>
      <Table Name="table1">
        <Footer>
          <TableRows>
            <TableRow>
              <TableCells>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="textbox7">
                      <rd:DefaultName>textbox7</rd:DefaultName>
                      <ZIndex>7</ZIndex>
                      <Style>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingBottom>2pt</PaddingBottom>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                      </Style>
                      <CanGrow>true</CanGrow>
                      <Value />
                    </Textbox>
                  </ReportItems>
                </TableCell>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="textbox8">
                      <rd:DefaultName>textbox8</rd:DefaultName>
                      <ZIndex>6</ZIndex>
                      <Style>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingBottom>2pt</PaddingBottom>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                      </Style>
                      <CanGrow>true</CanGrow>
                      <Value />
                    </Textbox>
                  </ReportItems>
                </TableCell>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="textbox6">
                      <rd:DefaultName>textbox6</rd:DefaultName>
                      <ZIndex>5</ZIndex>
                      <Style>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingBottom>2pt</PaddingBottom>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                      </Style>
                      <CanGrow>true</CanGrow>
                      <Value />
                    </Textbox>
                  </ReportItems>
                </TableCell>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="textbox9">
                      <rd:DefaultName>textbox9</rd:DefaultName>
                      <ZIndex>4</ZIndex>
                      <Style>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingBottom>2pt</PaddingBottom>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                      </Style>
                      <CanGrow>true</CanGrow>
                      <Value />
                    </Textbox>
                  </ReportItems>
                </TableCell>
              </TableCells>
              <Height>0.63492cm</Height>
            </TableRow>
          </TableRows>
        </Footer>
        <DataSetName>WindowsApplication1_MedcialCase</DataSetName>
        <Top>0.25cm</Top>
        <Details>
          <TableRows>
            <TableRow>
              <TableCells>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="ID">
                      <rd:DefaultName>ID</rd:DefaultName>
                      <ZIndex>3</ZIndex>
                      <Style>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingBottom>2pt</PaddingBottom>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                      </Style>
                      <CanGrow>true</CanGrow>
                      <Value>=Fields!ID.Value</Value>
                    </Textbox>
                  </ReportItems>
                </TableCell>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="Name">
                      <rd:DefaultName>Name</rd:DefaultName>
                      <ZIndex>2</ZIndex>
                      <Style>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingBottom>2pt</PaddingBottom>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                      </Style>
                      <CanGrow>true</CanGrow>
                      <Value>=Fields!PatientOfMedcialCase.Value.Name.Value</Value>
                    </Textbox>
                  </ReportItems>
                </TableCell>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="Name_1">
                      <rd:DefaultName>Name_1</rd:DefaultName>
                      <ZIndex>1</ZIndex>
                      <Style>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingBottom>2pt</PaddingBottom>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                      </Style>
                      <CanGrow>true</CanGrow>
                      <Value>=Fields!Name.Value</Value>
                    </Textbox>
                  </ReportItems>
                </TableCell>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="PatientOfMedcialCase">
                      <rd:DefaultName>PatientOfMedcialCase</rd:DefaultName>
                      <Style>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingBottom>2pt</PaddingBottom>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                      </Style>
                      <CanGrow>true</CanGrow>
                      <Value>=Fields!PatientOfMedcialCase.Value</Value>
                    </Textbox>
                  </ReportItems>
                </TableCell>
              </TableCells>
              <Height>0.63492cm</Height>
            </TableRow>
          </TableRows>
        </Details>
        <Header>
          <TableRows>
            <TableRow>
              <TableCells>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="textbox1">
                      <rd:DefaultName>textbox1</rd:DefaultName>
                      <ZIndex>11</ZIndex>
                      <Style>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingBottom>2pt</PaddingBottom>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                      </Style>
                      <CanGrow>true</CanGrow>
                      <Value>ID</Value>
                    </Textbox>
                  </ReportItems>
                </TableCell>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="textbox2">
                      <rd:DefaultName>textbox2</rd:DefaultName>
                      <ZIndex>10</ZIndex>
                      <Style>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingBottom>2pt</PaddingBottom>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                      </Style>
                      <CanGrow>true</CanGrow>
                      <Value>Name</Value>
                    </Textbox>
                  </ReportItems>
                </TableCell>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="textbox4">
                      <rd:DefaultName>textbox4</rd:DefaultName>
                      <ZIndex>9</ZIndex>
                      <Style>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingBottom>2pt</PaddingBottom>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                      </Style>
                      <CanGrow>true</CanGrow>
                      <Value>Name</Value>
                    </Textbox>
                  </ReportItems>
                </TableCell>
                <TableCell>
                  <ReportItems>
                    <Textbox Name="textbox3">
                      <rd:DefaultName>textbox3</rd:DefaultName>
                      <ZIndex>8</ZIndex>
                      <Style>
                        <PaddingLeft>2pt</PaddingLeft>
                        <PaddingBottom>2pt</PaddingBottom>
                        <PaddingRight>2pt</PaddingRight>
                        <PaddingTop>2pt</PaddingTop>
                      </Style>
                      <CanGrow>true</CanGrow>
                      <Value>Patient Of Medcial Case</Value>
                    </Textbox>
                  </ReportItems>
                </TableCell>
              </TableCells>
              <Height>0.63492cm</Height>
            </TableRow>
          </TableRows>
        </Header>
        <TableColumns>
          <TableColumn>
            <Width>5.33333cm</Width>
          </TableColumn>
          <TableColumn>
            <Width>8cm</Width>
          </TableColumn>
          <TableColumn>
            <Width>5.33333cm</Width>
          </TableColumn>
          <TableColumn>
            <Width>5.33333cm</Width>
          </TableColumn>
        </TableColumns>
        <Height>1.90476cm</Height>
      </Table>
    </ReportItems>
    <Height>5cm</Height>
  </Body>
  <rd:ReportID>a69b2d8e-258a-4212-8d4a-c67c96055732</rd:ReportID>
  <LeftMargin>2.5cm</LeftMargin>
  <DataSets>
    <DataSet Name="WindowsApplication1_MedcialCase">
      <rd:DataSetInfo>
        <rd:DataSetName>WindowsApplication1</rd:DataSetName>
        <rd:ObjectDataSourceType>WindowsApplication1.MedcialCase, WindowsApplication1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
        <rd:TableName>MedcialCase</rd:TableName>
      </rd:DataSetInfo>
      <Query>
        <rd:UseGenericDesigner>true</rd:UseGenericDesigner>
        <CommandText />
        <DataSourceName>DummyDataSource</DataSourceName>
      </Query>
      <Fields>
        <Field Name="ID">
          <rd:TypeName>System.Guid</rd:TypeName>
          <DataField>ID</DataField>
        </Field>
        <Field Name="PatientOfMedcialCase">
          <rd:TypeName>WindowsApplication1.Patient</rd:TypeName>
          <DataField>PatientOfMedcialCase</DataField>
        </Field>
        <Field Name="Name">
          <rd:TypeName>System.String</rd:TypeName>
          <DataField>Name</DataField>
        </Field>
      </Fields>
    </DataSet>
  </DataSets>
  <Width>24cm</Width>
  <InteractiveHeight>29.7cm</InteractiveHeight>
  <Language>en-US</Language>
  <TopMargin>2.5cm</TopMargin>
  <PageHeight>29.7cm</PageHeight>
</Report>

the object I bind  to the Report like

public class MedcialCase
    {
        private Guid iD;

        public Guid ID
        {
            get { return iD; }
            set { iD = value; }
        }

        private Patient patient;

        public Patient PatientOfMedcialCase
        {
            get { return patient; }
            set { patient = value; }
        }

    }

    public class Patient
    {
        private string name;

        public string Name
        {
            get { return name; }
            set { name = value; }
        }

    }

and the code bind object to report like

  MedcialCase medcialCase = new MedcialCase();
  medcialCase.ID = Guid.NewGuid();
  Patient patient = new Patient();
  patient.Name = "Michael";
  medcialCase.PatientOfMedcialCase = patient;
  this.MedcialCaseBindingSource.DataSource = medcialCase;
  this.reportViewer1.RefreshReport();

I choose the MedcialCase.ID and MedcialCase.PatientOfMedcialCase.Name to show, but when the report was run ,,just MedcialCase.ID has been shown,
the text of MedcialCase.PatientOfMedcialCase.Name is "=Fields!Name.Value"

I modify it to "=Fields!PatientOfMedcialCase.Value.Name.Value" and run it ,the "#Error" show in the text of Name

anyone can tell me why?and how to bind object like MedcialCase to the Report?

thanks!

 

View 9 Replies View Related

Any One Tell Me The Best Process To Bind The Data To Datagrid?

Jun 2, 2008

Hi,

Any one tell me the best process to bind the data to datagrid?I am using this method,it is taking lot of time to fill data to datagrid.

conn = new SqlCeConnection("Data Source=\sample.sdf; Password =''");
dt = new DataTable();
da = new SqlCeDataAdapter(Quary, conn);
da.Fill(dt);
DataaGrid1.Datasource=dt;

Any one tell the best method?

Regards,
venkat.

View 9 Replies View Related

Profiler Trace Bind Variables

Aug 2, 2007

Hi,

Could anyne help me on which options in Profiler could be used to trace the bind variables in DML?

Given a table, X (col1 number, col2 varchar(10)), where col1 is primary key.

Example DML statements:

1) insert into X values (@parameter1, @parameter2)
2) update X set col2 = @parameter2 where col1 = @parameter1
3) delete X where col1 = @parameter1

where @parameter1 and @parameter2 are bind variables.

Can Profiler be configured to log the actual values of @parameter1 and @parameter2 in the example statements in trace log?

Thanks a lot.

View 6 Replies View Related

How To Bind Return Value From Function Call

Dec 21, 2007

I have a function that I need to call from an execute sql task. I want to bind the return value from the function to an ssis variable.

Can someone please show me an example of what the function syntax needs to look like in order for this to work? I know that with sp's, you need to explicitly state the column names.

I have tried many things without success.

Thanks

View 13 Replies View Related

Bind Computed Textbox Value To Database Field

Sep 11, 2007

Hi all,
I have three textboxes in a form view
1- Qty textbox
2- price textbox
3-TotalPrice textbox which value is the result of multiplying the previous two values
and then I want to Bind() the third value to the totalprice field in the database
how can I do  that??
(without making the database field as a computed column)
 
 
thanks for any help

View 3 Replies View Related

Bind Message Of Storedproc To Lable Control

Mar 23, 2008

 Hi can anyone tell meHow to bind messages in storedproc to lable control in the front end.I have a stored proc which updates the data table.in certain condition update should not take place and a message should be generated that update did not take place.Can anyone tell me how that message can be shown in front endmy taught was to bind it using lable control. But how the messages can come from storedproc to front endcan we do it using dataset binding.Is there any other way please lemme know immediately .Thankyousiri 

View 4 Replies View Related

Bind Data From A Sql Statement To A Hidden Field?

Apr 18, 2008

What is the vb.net syntax to bind data from a sqldatasource to a hidden field in a form? 

View 6 Replies View Related

Bind Individual Controls To A Single SqlDataSource

May 9, 2008

hello friends iam newlly joined in to company any one can help me how to bind individual controls to a single SqlDataSource Control..
my problem is "i have different text boxes and dropdown boxes and what i want to do is if i enter primary ker field(employeeno) in the text box automatically i need to get that particular record and i need to populate it to the Respective controls...
is there any chance of doing this by using a single datasource control..
 
pls help me its urgent
Regards
k.seshu

View 3 Replies View Related

Bind Multi-table Dataset To A Datagrid

Jul 20, 2004

I have created a SQL procedure that returns a dataset with a varying number of tables like the following example:

RepID---- PhoneUPS
----------- -----------
3---------- 3

RepID---- PhoneUPS
----------- -----------
4---------- 0

RepID---- PhoneUPS
----------- -----------
5---------- 2

No more results.
(9 row(s) returned)
@RETURN_VALUE = 0


All of the tables have the same header row, but are a seperate table. From my experience, I am not able to bind more than one table to a datagrid. Does anyone have any suggestions on how I can go about displaying this full dataset on my aspx page? I've been going in circles on this for two days, so I'm open to any suggestions :)

Cheers,
Andrew

View 6 Replies View Related







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