SqlDataSource - Need To Refresh Grid When Data Updated Programmatically

Nov 27, 2007

I am sending a GUID to a form via the query string.  If it exists I use helper functions to load most of the form text boxes.  However, if it does not then a blank form is presented and the GUID is stored in a hidden field. 

Regardless, I use this hidden field to populate a grid that is attached to a sqldatasource.

If I then add new datarows to the backend database programmatically, I cannot 'requery' the datasource to include those row upon a postback.  I cannot seem to find a simple way to force the sqldatasource to rerun the query.

Can anyone help.

View 2 Replies


ADVERTISEMENT

Refresh An SQLDataSource Object Programmatically

Oct 27, 2006

Background - I have a page that uses a numeric value stored in a Session object variable as the parameter for three different SQLDataSource objects, which provide data to two asp:Repeaters and an asp:DataList.  Also, in the Page_Load, I use this value to to seed a stored procedure and an SQLDataReader to populate several unbound Labels.  This works fine.  In addition, I have a collection of 6 TextBoxes, an unbound Listbox, and two Buttons to allow the user to do searching and selection of potential matches.  This basically identifies a new numeric value that I store in the Session variable and PostBack the page (via one of the buttons).  This also works fine.Problem - I have been tasked with taking a different page and adding six textboxes to collect the search values, but to post over to this page, populate the existing search-oriented TextBoxes, adn programmatically triggering the search.  Furthermore, I have to detect the number of matching records and, if only 1, have the Repeaters and DataList display the results based on the newly selected record's key numeric value, as well as populating the unbound Labels.  I have managed to get all of this accomplished except for programmatically triggering the Repeaters and DataList "refresh".  These controls only populate as expected if a button is clicked a subsequent time, which makes sense, since that would trigger a PostBack and the Page_Load uses the new saved numeric key value from the Session.My history in app development is largely from Windows Forms development (VB6), this is my second foray into Web Form dev with ASP.NET 2.0.  I am willing to acceptthat what I am trying to do does not fit into the ASP environment, but I have to think that this is something that has been done before, and (hopefully) there is a way to do what I need.  Any ideas, oh great and wise Forum readers? *smile* 

View 3 Replies View Related

Bind Grid To SQLce Data That Is Being Updated From Another Thread

Dec 17, 2007

Hi

We are building a near real time application in Windows Forms, that stores data in SQL Compact Edition.
The client receives messages via UDP socket and performs insert / update operations to the db accordingly, and the requirement is to update a data grid with the changes.

We tried querying the db and receive a ResultsSet which is sensitive and scrollable, and bind a ResultSetView to the Grid. But, since the updates are made from another thread, the grid is not being refreshed.

What is the best approach for achieving this?

Thanks in advance,

Guy Burstein
http://blogs.microsoft.co.il/blogs/bursteg

View 3 Replies View Related

Help: Programmatically Update Data From An SQLDataSource (C#)

Jul 3, 2007

ello all
 Would someone be so kind as to save me from getting balder through pulling my hair out.
My aim is to extract data from a database using SQLDataSource, then edit the data and update the database using the SQLDataSource.
I have achieve the problem of retrieving the data from the sqlDataSource:DataView openRemindingSeats = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);        //Int32 openRemindingSeats = SqlDataSource2.Select(DataSourceSelectArguments.Empty), DataView;
        foreach (DataRowView rowProduct in openReminding)        {            //Output the name and price            lbl_NumOfSeatsLeft.Text = rowProduct["Remaining"].ToString();
        }
Within the sqlDataSource the sql code is as follows:SELECT [refNumber], [refRemaining] FROM [refFlights] WHERE ([refNumber] = @Number)
So at the moment my problems is being able to edit and update data to the same SELECTed data.Thank you for any help that you might have...
SynDrome

View 8 Replies View Related

How Do I Programmatically Inert Data Using A SqlDataSource Control?

May 19, 2007

I just want to insert a record into a table using a SqlDataSource control.  But I'm having a hard time finding examples that don't use data bound controlsI have this so far (I deleted the parts not related to the insert):<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:UserPolls %>"    InsertCommand="INSERT INTO [PollAnswers] ([PollId], [AnswerText], [AnswerCount]) VALUES (@PollId, @AnswerText, @AnswerCount)"    <InsertParameters>        <asp:Parameter Name="PollId" Type="Int32" />        <asp:Parameter Name="AnswerText" Type="String" />        <asp:Parameter Name="AnswerCount" Type="Int32" />    </InsertParameters> </asp:SqlDataSource> This is the data source for a gridview control I have on the page.  I could set up an SqlDataSource for this alone if I need to, but i don't know if it would help.  From what I could find, in the code behind I should haveSqlDataSource2.Insert()and SqlDataSource2  will grab the parameters and insert the record.  The problem is I need to set the Pollid (from a session variable) and AnswerText (from a text box) at run time.  Can I do this?Diane 

View 3 Replies View Related

Accessing Data From A Programmatically Created SqlDataSource

Nov 3, 2007

Hi
I think I've programmatically created a SqlDataSource - which is what I want to do; but I can't seem to access details from the source - row 1, column 1, for example????
If Not Page.IsPostBack Then
'Start by determining the connection string valueDim connString As New Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString)
'Create a SqlConnection instanceUsing connString
'Specify the SQL query
Const sql As String = "SELECT eventID FROM viewEvents WHERE eventID=17"
'Create a SqlCommand instanceDim myCommand As New Data.SqlClient.SqlCommand(sql, connString)
'Get back a DataSetDim myDataSet As New Data.DataSet
'Create a SqlDataAdapter instanceDim myAdapter As New Data.SqlClient.SqlDataAdapter(myCommand)
myAdapter.Fill(myDataSet)Label1.Text = myAdapter.Tables.Rows(0).Item("eventID").ToString() -??????????????
'Close the connection
connString.Close()
End Using
End IfThanks for any helpRichard
 

View 1 Replies View Related

How To Populate Grid From SQLDataSource When Clicking On Button

Nov 20, 2007

how to populate grid from SQLDataSource  when clicking  on button

View 2 Replies View Related

SqlDataSource Refresh Problem

Jul 16, 2007

Dear sirs:I have a Web Form with an SqlDataSource with a simple select statement, and a GridView control that is tied to it. There is a ComboBox (which provides the filter-command parameter) and a Submit button as well. When a selection is made (the first time) in the combo box and then the submit button is clicked, the Selecting Event for the SqlDataSource fires and the code works perfect.However, on subsequent "submits" with the button and selecting a different month from the combo box, I cannot get that event to fire again. What do I need to do to get this event to fire everytime the submit button is clicked and a new selection made from the drop down combo box; thus letting me know that new data is being fetched from the database?Here is the code for the SqlDataSource:<<asp:SqlDataSourceID = "sqlDataSourceG5WingRailCar" runat = "server" ConnectionString = "<%$ ConnectionStrings:oracleConnectionString %>"ProviderName = "<%$ ConnectionStrings:oracleConnectionString.ProviderName %>" SelectCommand = "select distinct to_date( mh.historydatetime , 'DD-MM-YYYY' ) ,                            rh.movedescription ,                            ( mds.pct_util * count( rh.movedescription ) )                            from requesthistory rh                            inner join movehistory mh on rh.itd_number = mh.itd_number                            inner join movedescription mds on rh.movedescr_id = mds.movedescr_id                            where rh.movedescr_id = 1 AND mh.discrepancy_id = 25 AND EXTRACT(MONTH FROM mh.historydatetime) = :MONTH_ID                            group by to_date( mh.historydatetime , 'DD-MM-YYYY' ) ,                                         rh.movedescription ,                                         mds.pct_util                            order by to_date( mh.historydatetime , 'DD-MM-YYYY' )" önSelecting="sqlDataSourceG5WingRailCar_Selecting" ><<SelectParameters>><<asp:ControlParameter ControlID = "dropDownListMonth" Name = "MONTH_ID" PropertyName = "SelectedValue" >><</asp:ControlParameter>><</SelectParameters>> <</asp:SqlDataSource>>There really is no code for the Selecting Event, other than just capturing some text into a label when the event occurs (for testing purposes).Thanks

View 2 Replies View Related

Creating SQLDataSource Programmatically?

Apr 17, 2007

Hello. Im trying to create an SQLDataSource control programmatically. I need to do this because I want to do some stuff on my MasterPage's 'Page_Init' event.
 heres my code (Master.master.vb): Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
lblUser.Text = Page.User.Identity.Name

Dim PUser As New ControlParameter
PUser.ControlID = "lblUser"
PUser.Name = "LoginName"
PUser.PropertyName = "Text"
PUser.Type = TypeCode.String
PUser.DefaultValue = Page.User.Identity.Name

Dim SQLDS_Login As New SqlDataSource
SQLDS_Login.ID = "SQLDS_Login"
SQLDS_Login.ConnectionString = "I put conection string here. How do I use the one on my web.config?"
SQLDS_Login.SelectCommand = "SELECT [LoginID], [LoginName], [Role], [Status] FROM [myLogin] WHERE ([LoginName] = @LoginName)"
SQLDS_Login.SelectParameters.Add(PUser)
SQLDS_Login.SelectCommandType = SqlDataSourceCommandType.Text

GridView1.DataSource = SQLDS_Login
GridView1.DataBind()

End Sub
 
When i run, i get this error message:
The SqlDataSource control 'SQLDS_Login' does not have a naming container.  Ensure that the control is added to the page before calling DataBind.
 I never had any problem with Inserts, Updates and Deleting, but I have never made it work for Select when doing it programmatically.
Can you help me with this?

View 1 Replies View Related

Programmatically Add ArrayList Into To Sqldatasource.

Jul 15, 2007

I am trying to add a number of dates into a Sql database.  Basically I want the user to add the start and end date and then all the dates in between are are added to a database in unique records. I can create an ArrayList but I don't know how to bind it to an SqlDataSource   Dim startdate As DateTime = tbstartdate.Text Dim enddate As DateTime = tbenddate.Text Dim datediff As TimeSpan = enddate.Subtract(startdate) Dim noofdays As Integer = datediff.Days Dim ar As New ArrayList Dim i For i = 0 To noofdays ar.Add(startdate.AddDays(i)) Next Sorry if this is a total noob question.... 

View 1 Replies View Related

Programmatically Specify SqlDataSource Parameters

Apr 27, 2006

I have a GridView bound to a SqlDataSource. On page load I would like to programmatically specify a SelectParameter value based on the role of the user. This SelectParameter will be used in my WHERE clause. The closest post I can find is http://forums.asp.net/thread/1233258.aspx but no answer was posted.
What code would I use to modify a SelectParameters value? Is it possible to reference a parameter by name (SqlDataSource1.SelectParameters["usertype"]) or does it have to be by index? (SqlDataSource1.SelectParameters[0])
Alternatively, perhaps I'm going about this in the wrong way, is there a better way to have dynamic GridView content based on the role of the user?
Thank you very much for your help.

View 3 Replies View Related

How To Programmatically Construct The UpdateCommand For SqlDataSource

Aug 1, 2007

Hi, All
I'm using Gridview and SqlDataSource to dynamically display the contents in different tables, as followed:
<%   dataSource.ConnectionString = System.Configuration.ConfigurationSettings.AppSettings["connectionString"];   dataSource.SelectCommand = "SELECT * FROM " + tableName;   gridView.DataBind();
   dataSource.UpdateCommand = "";%>
<asp:SqlDataSource ID="dataSource" runat="server"></asp:SqlDataSource><asp:GridView ID="gridView" runat="server" DataSourceID="dataSource" AllowPaging="True" AllowSorting="True" AutoGenerateEditButton="True" BorderColor="Silver" BorderStyle="Solid" BorderWidth="1px" CellPadding="3" PageSize="20" DataKeyNames="ID" OnRowDataBound="tableGridView_RowDataBound">    <HeaderStyle BackColor="#C0C0FF" />    <AlternatingRowStyle BackColor="#C0FFC0" /></asp:GridView>
The datasource take the "tableName" as argument to determine which table to display. My problem is I can't figure out a way to programmatically construct the UpdataCommand for the SqlDataSource. I try to get the field names from the HeaderRow, but all the cells are empty in this row.
Does anyone know what causes the problem or how to construct the UpdateCommand properly. Thanks!

View 3 Replies View Related

Gridview Updated + SQLDatasource + UserName

Apr 15, 2008

Hi
I have a gridview which is using a SQLdatasource, to update the table.  One of my parameters on the SP is username.
At the moment on page load I am declaring a session variable
Session("UserName") = me.user.identy.name
I then amend the update parameter in the SQL Datasource to accept the username from the session variable.  - works fine,  I was however wondering if there is a way of returning the username directly into the sqldatasource without having to pass it through a session variable?
 
regards
 
Tom

View 3 Replies View Related

Using SqlDatASource Programmatically - Output Parameters

May 13, 2006

I am using SqlDataSource programmatically in my data access layer - mainly for convenience but it does generally work fine with no obvious performance issues.
The problem I have is with getting back an output parameter. I have an insert-type stored procedure (in Sql Server 2005) operating on a table with an identity column as the primary key:
ALTER PROCEDURE [dbo].[InsertAlbum](@ArtistID int, @Title nvarchar(70), @NewID int OUTPUT)ASDECLARE @err intINSERT INTO dbo.ALBUMS (ARTISTID, TITLE)VALUES (@ArtistID, @Title)SELECT @err = @@error IF @err <> 0 RETURN @errSET @NewID = SCOPE_IDENTITY()
This works fine when run from Sql Server Management Studio and @NewID has the correct value.
My data access code is roughly as follows:
dsrc = New SqlDataSource()dsrc.ConnectionString = ConnectionStringdsrc.InsertCommand = "InsertAlbum"dsrc.InsertCommandType = SqlDataSourceCommandType.StoredProcedureDim parms As ParameterCollection = dsrc.InsertParametersDim newid As IntegerAddParameter(parms, "ArtistID", TypeCode.Int32, ParameterDirection.Input, 0, album.ArtistID)AddParameter(parms, "Title", TypeCode.String, ParameterDirection.Input, 0, album.Title)Dim p As New Parameter("NewID", TypeCode.Int32)p.Direction = ParameterDirection.Outputparms.Add(p)Try   Dim rv As Integer = dsrc.Insert()   newid = parms("NewID")   Return newidCatch ex As Exception   Return -1End Try
The row is inserted into the database, but however I try to define and add the NewID parameter it never has a value.
Has anyone tried to do this and can tell me what I am doing wrong?
Jon
 

View 8 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

SQLDataSource Provide Select Parameter Value Programmatically

Sep 9, 2007

Hey All for some reason I can not get this right and/or find what I am looking for.
I have an SQLDataSource with a PartID set as the filtered value in the Datasource Query.
I am trying to use code beside to set the value and I am failing...lol...
Here is my attempt at it,
SqlDataSource1.SelectParameters("PartID") = txtPartID.Text
Any help would be great!

View 2 Replies View Related

Programmatically Getting The Field Values Form An Sqldatasource Control

Oct 10, 2006

Im ripping my hair out here.I need to access the field in a datasource control of use in non presentation layer code based actions.I know the I can use a code base connection and query but I dont see why i need to make two trips the the DB when the info is already available.The datasource is attached to a details view control and the details view control is nested in a loginview controlI've tried defining but all I can get in the header name of the field but not the dataitem, the dataitem causes an error  help please jim

View 4 Replies View Related

Programmatically Accessing An SQLDataSource With A SELECT COUNT(*) Query.

Jun 20, 2007

I've found example code of accessing an SQLDataSource and even have it working in my own code - an example would be  Dim datastuff As DataView = CType(srcSoftwareSelected.Select(DataSourceSelectArguments.Empty), DataView)  Dim row As DataRow = datastuff.Table.Rows(0)   Dim installtype As Integer = row("InstallMethod")  Dim install As String = row("Install").ToString  Dim notes As String = row("Notes").ToString The above only works on a single row, of course. If I needed more, I know I can loop it.The query in srcSoftwareSelected is something like "SELECT InstallMethod, Install, Notes FROM Software"My problem lies in trying to access the data in a simliar way when I'm using a SELECT COUNT query. Dim datastuff As DataView = CType(srcSoftwareUsage.Select(DataSourceSelectArguments.Empty), DataView) Dim row As DataRow = datastuff.Table.Rows(0) Dim count As Integer = row("rowcnt") The query here is "SELECT COUNT(*) as rowcnt FROM Software"The variable count is 1 every time I query this, no matter what the actual count is. I know I've got to be accessing the incorrect data member in the 2nd query because a gridview tied to srcSoftwareUsage (the SQLDataSource) always displays the correct value. Where am I going wrong here?  

View 6 Replies View Related

Programmatically Loop Through Sqldatasource - Which Event To Place It In...to Get The Right Order....

Mar 7, 2008

Hello,  I want to loop through the first 10 records that are showing in a gridview with several pages that is populated by a sqldatasource.  I can loop through the sqldatasource and get the list of values, but I'm doing something wrong because the 10 records it prints out are not the same 10 records the user sees in the gridview...They can click a search button which changes the sort, and they can click on the column headings to change the sort order.
Where's the best place to put the looping code?  I need the result to be the same as what the users sees. 
  1        Protected Sub GridView1_Sorted(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.Sorted2            Dim i As Integer = -13            Dim sTest As String = ""4            Dim vwExpensiveItems As Data.DataView = CType(SqlDataSource1.Select(DataSourceSelectArguments.Empty), Data.DataView)5    6            'Loop through each record7            i = -18            For Each rowProduct As Data.DataRowView In vwExpensiveItems9                i = i + 110               'Output the name and price11               If i > 9 Then12                   Exit For13               End If14               sTest = rowProduct("employeeid")15               Response.Write("RowSorting " & i.ToString & " [" & sTest & "]<br>")16           Next17       End Sub18    

View 3 Replies View Related

How Can I Return Data From A Database And Fill A Data Grid View?

May 2, 2007

Hi ! I have a textbox and a Search button. When the user inputs a value and press the button, i  want a datagrid to be filled.
The following code runs:
Dim connect As New Data.SqlClient.SqlConnection( _
"Server=SrvnameSQLEXPRESS;Integrated Security=True; UID= ;password= ; database=dtbsname")
connect.Open()
Dim cmd As New SqlCommand
Dim valor As New SqlParameter("@valor", SqlDbType.VarChar, 50)
cmd.CommandText = "Ver_Contactos_Reducido"
cmd.CommandType = CommandType.StoredProcedure
cmd.Connection = connect
cmd.Parameters.Add(valor)
cmd.Parameters("@valor").Value = texto
Dim adapter As New SqlDataAdapter(cmd)
Dim ds As New System.Data.DataSet()
adapter.Fill(ds)
GridViewContactos.DataSource = ds
GridViewContactos.DataBind()
connect.Close()
I drag a datagrid on the page and only changed its Id.
Into the SQL database the stored procedure is the following:
ALTER PROCEDURE [dbo].[Ver_Contactos_Reducido]
(@Valor VARCHAR(100))
AS
BEGIN
SET NOCOUNT ON;
SELECT NombreRazonSocial, Nombre, Apellido,TelefonoLaboral,
Interno, TelefonoCelular, Email1, Organizacion
FROM CONTACTOS
WHERE NombreRazonSocial = @Valor OR Nombre = @Valor OR Apellido = @Valor OR  TelefonoLaboral = @Valor OR Interno = @Valor OR
TelefonoCelular =@Valor OR Email1 = @Valor OR Organizacion= @Valor
END
When i run the page i can't see the datagrid, and after i enter a text and press the button, nothing happens. What am i doing wrong??
Thks!!

View 2 Replies View Related

Fill Data Grid With Data From JOIN Query

Jul 8, 2013

I am working on a school project and have come up against a bit of a sticking point. I am supposed to be creating a very basic OMS, the teacher themselves have said they do not know how to do this (in previous years it has all be done via Access) but apparently I am a lucky one to be doing it in SQL this year.

So I have 2 tables for products in the system

products
+-----------+------------+
|productid |productname |
|Int |varchar(50) |
+-----------+------------+

productdetail
+---------+----------+------------+------+------+
|detailId |productid |description |price |stock |
|Int |Int |Text |Money |Int |
| |FK_From_ | | | |
| |productid_| | | |
| |products | | | |
+---------+----------+------------+------+------+

One of the user requirements of the OMS is to fill a data grid with product name and the product details which I have the query for or rather I have created a view for, which is then queried from a stored procedure.

CREATE VIEW [dbo].[v_stock]
AS SELECT tab_products.productname, tab_productdetails.description, tab_productdetails.image, tab_productdetails.price, tab_productdetails.stock
FROM tab_productdetails INNER JOIN
tab_products ON tab_productdetails.productid = tab_products.productid

The problem I am having is then returning the data from this query into a data grid, I think the reason is because when I attached the stored procedure to a table and then call that procedure via the table adapter there is a mismatch of the schema - specifically the table it is attached to does not contain the column "productName".

I am thinking I need to create a temporary table to fill the data grid with - however, I am not sure how I would create a temporary table.

Is there something I am missing or not done correctly. As far as I can tell the queries work as when I preview them they produce the expected results.

View 1 Replies View Related

Regarding Data Grid

Oct 23, 2006

what datafield shoud i put in my database if its a checkbox option? coz in my datagrid i added a checkedbox so that i can easily manipulate it.but when i run it. it produces error. and doesnt recognize the checkbox column.it said that there none in the datasource.but i dont know what should i put in the database! pls help!thanks

View 1 Replies View Related

SQL Statements For A Data Grid

Apr 4, 2007

I've created a Data Set with a connection string to my sql database however when i go to create queries and select 'generate update, delete and insert statements' it doesn't do it.  I'm wondering why and how do i get this fixed since i don't know how to code it myself.
 
Thank you.

View 2 Replies View Related

ASP Data Grid Needed

Aug 12, 2004

I need to display data from a sql server 2000 db on an asp web page and I need a vertical split. Does anyone have any solutions? I really can't afford to spend much/any money so freeware/shareware or coding suggestions is what I am interested in.

Thanks!

View 2 Replies View Related

Updating Grid Containing Data From Few Tables

Jul 22, 2004

Hi I want to update the grid which in turn will load data to a few tables: the main table and it's lookup tables, I want to write a stored procedure that will check if the data from lookup table already exists and if not it will insert it
but I am only starting to get to know stored procedure structure
could you give me some advice on how to write such procedure I would be veeeery gratefull

View 2 Replies View Related

Update Data In Grid View

Jul 19, 2013

I want to update a data in grid view

I have three columns in grid view

First two column are shift id and date these two column are taken from table 1

The third column is shift column this column are taken from table 2

Now I want to update a data where shift id and shift column are same

table 2 have these column
shift
shiftid

and table 1 has these column
shift id,
date

View 5 Replies View Related

Data Grid With Para Meter Question

Jan 18, 2007

I have the following code: Imports System
Imports System.Data.SqlClient

Namespace TestWeb


Partial Class araging

Inherits System.Web.UI.Page

Private _dt As DataTable
Private _connstr As String

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub


Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim _connstr As New SqlConnection(ConfigurationManager.ConnectionStrings("ESQLConn").ConnectionString)

Dim sqlCommand As SqlCommand = New SqlCommand("csp_rpt_ack_form", _connstr)


sqlCommand.CommandType = CommandType.StoredProcedure

Dim objaDapter As New SqlDataAdapter(sqlCommand)

objaDapter.SelectCommand.Parameters("@v_order_doc_no").Value = 272

Dim ds As New DataSet
objaDapter.Fill(ds)
mainGrid.DataSource = ds
mainGrid.DataBind()


Response.Write(_connstr)


End Sub



End Class


End Namespace
  I am trying to pass a value to the parameter that it contains. What Im I doing wrong? I keep on getting the following message."An SqlParameter with ParameterName '@v_order_doc_no' is not contained by this SqlParameterCollection." Thanks guys!  

View 4 Replies View Related

Trouble With Editable Data Grid In A Web Page

Apr 12, 2004

I try to find the way to create editable data grid (a view from MySQL database) in a web page. So, user can edit, add, or delete from one page instead of having switch edit, insert pages, one field in the view only. Any script I need to write or any special server behavior I can use?

Thanks a lot any one can help with.

Ann

View 1 Replies View Related

T-SQL (SS2K8) :: Turning Raw Data Into A Grid Layout

Jan 1, 2013

I have a table which stores all prices for companies daily trading. Companies ABC & XYZ have information available for what was the high & low values for a DateID.

CREATE TABLE [dbo].[TestGrid]
(
[ID] [int] IDENTITY(1,1) NOT NULL,
[CompanyName] [varchar](200) NOT NULL,
[DateID] [int] NOT NULL,
[High] [float] NOT NULL,
[Low] [float] NOT NULL

[code]...

What I'm trying to do is turn the DateID into columns and then as a additional change those columns represent the actual day of the Date ID How would i know 20121201 is equal to say Monday and 02 is Tuesday?

END RESULT:

NAME TYPE MONDAY TUESDAY WEDNESDAY
ABC HIGH 0.5 0.6 1
ABC LOW 0.1 1.5 0.6

View 9 Replies View Related

Display Null Value In Data Grid Viewer Using C#

May 3, 2015

I have table in sql server for Employee, it has(id, Employee, director),so the director field is id of the director's name,  so the director is employee and has director also, only the first director hasn't director( one Employee has not director);now, i want to use datagridviewer in c# for display as this table (id, employee, director), so the first record will be the (id, employee, '  ');i use this query:"select emp.ID ,emp.Name ,dir.Name as'director'  from table1 emp, table1 dir where (emp.director=dir.ID OR  dir.director IS NULL)"but when i display the datagridviewer , it don't display the first employee(first director) which hasn't director.

View 6 Replies View Related

Sorting Columns In Grid Data Viewer

Aug 28, 2007

Has anyone ever looked at the way the grid data viewer sorts it data when
clicking on a column header? If you click on a column header, something
happens to the sorting of the data in the viewer, but it's not always clear
to me _what_ is happening. It appears the data is sorted ascending on the
column you clicked on. If you click again the sort order seems to inverse to
descending. However, if you look closely, it turns out that the data is not
always sorted correctly, especially when you click on an integer valued
column.

I found this when doing a demo on the AdventureWorks demo extracting data
from the SalesOrderDetail table. If you sort on the OrderQty column, data is
correctly sorted in ascending quantities. However, if you click the column
again, orders with an order quantity of 2 are displayed on top (while there
are orders with a much higher order quantity) and if you scroll down the
list, you notice that there is no clear sorting anymore. The same happens
with other columns.

Is this supposed to work as I would expect it to do or is there a logical
explanation for the behaviour I see?

--
Best regards,

Hans Geurtsen
Docent Kenniscentrum

Info Support
De Smalle Zijde 39
3903 LM Veenendaal
The Netherlands
www.infosupport.nl

View 1 Replies View Related

SQL 2012 :: How To Format Data In A Grid View (Pivot)

Oct 23, 2015

I am looking for a way to create a stored procedure that will show inventory availability. I would like to show the Inventory Name, The Date, and if the inventory is "checked out" using the ID name of the person who has the item.

For example it would look like this:

--------------------------------------------------------------------------------------------------
Inventory Name | 10/24/2015 | 10/25/2015 | 10/26/2015 | 10/27/2015 | 10/28/2015
--------------------------------------------------------------------------------------------------
Laptop | Tom | Tom | Tom | Avail | Avail
Projector | Avail | Avail | Avail | Avail | Bob
Air Card | Bob | Bob | Bob | Bob | Bob

It seems like I want to do a pivot table but there really is no aggregate so I am not sure what to use.

View 8 Replies View Related

Grid And Details View Not Showing Remote Database Data

Oct 27, 2006

hi,i have an sql database on my server on the world wide web.i can make a connection  to the database in visual web developer and all the tables etc are shown in the 'database explorer' of visual web developerwhen i make the query in visual web developer it does retrieve the data froom the remote server database when i 'test query'.... so looking great!the connection string in the webconfig file is left as the default when i run the prgram on my LOCAL HOST with the inbult server that comes with visual web developer it runs fine......so.....running on my local pc it will connect to the database on my www host server and does display the data from that database.i need to change the webconfig files path to the connection  by default it is |DataDirectory|if i change this to the path i suspect is correct as this is the connection i use to the database  C:Inetpubvhostsarcvillage.comhttpdocsApp_DataTestdatabase.mdfwhen i change the path in webconfig then it stops working on my localhost and the error when i ftp it to my host is:Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed. any ideas? 

View 2 Replies View Related







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