Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
R

robw1888

@robw1888
About
Posts
11
Topics
6
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Retrieving Windows Login
    R robw1888

    Hi all I've created a ASP.NET/VB.NET intranet application to maintain a database via a datagrid and was looking to retrieve the Windows username of the current user of the application so that when they click to update any changes they make, a field in the database will update showing that user as the last person to update that record. I've set the authentication to 'windows' in the webconfig file, could anyone point me to the code I would need to retrieve the windows username? Many Thanks

    Rob

    ASP.NET csharp asp-net database security

  • Retrieving Windows User name/ID
    R robw1888

    Will do, thanks for the reply Dave.

    Rob

    Visual Basic csharp asp-net database security

  • Retrieving Windows User name/ID
    R robw1888

    Hi all I've created a ASP.NET/VB.NET application to maintain a database via a datagrid and was looking to retrieve the Windows username of the current user of the application so that when they click to update any changes they make, a field in the database will update showing that user as the last person to update that record. I've set the authentication to 'windows' in the webconfig file, could anyone point me to the code I would need to retrieve the windows username? Many Thanks

    Rob

    Visual Basic csharp asp-net database security

  • Editable Datagrid - adding network user
    R robw1888

    thanks, I'll take a look!

    Rob

    ASP.NET csharp asp-net database sysadmin tutorial

  • Editable Datagrid - adding network user
    R robw1888

    Hi, I've got an ASP.NET application which has an editable datagrid linked to an access database. I'm looking to update a field in the database with the username of the person logged into the network to show the last person to update that record. Being new to ASP.NET I'm not sure where to start, would anyone have any links to good articles showing how to go about this? Many Thanks

    Rob

    ASP.NET csharp asp-net database sysadmin tutorial

  • Datagrid Dropdown list - setting initial value problems
    R robw1888

    Thanks kaps, Was another small problem I needed to sort but your suggestion got me past the initial error so I've got it all working now! Much appreciated!

    Rob

    ASP.NET help database announcement

  • Datagrid Dropdown list - setting initial value problems
    R robw1888

    Hi, I am calling the getselectedindex function after I've populated the dropdown. Not sure where I could be going wrong here!

    Rob

    ASP.NET help database announcement

  • Datagrid Dropdown list - setting initial value problems
    R robw1888

    Hi I'm using the following code to try and retrieve the current value of a database field to set that as the initial value of a dropdownlist in an editable datagrid.

    Function GetSelectedIndex(StatusID As String) As Integer
    'Loop through the DataSet DS
    Dim iLoop As Integer
    Dim DT As DataTable = DS.Tables("Statusds")
    For iLoop = 0 To DT.Rows.Count - 1
    If Int32.Parse(StatusID) = Int32.Parse(DT.Rows(iLoop)("StatusID")) Then
    Return iLoop
    End If
    Next iLoop
    End Function

    I get the following error - 'IndexOutOfRangeException: StatusID' when I remove the selectedindex function call I can use the list to update the database so seems to be a problem with my coding to retrieve the current value. The table I'm using has StatusID as the primary key field and 'Status' as the field I'm using for the ddl. any help would be much appreciated! Thanks

    Rob

    ASP.NET help database announcement

  • Datagrid Dropdownlist
    R robw1888

    Hi Dan, thanks for the reply. Here is my code showing functions to populate the dataset and to get the selected row. StatusID is the primary key in my access database & thought I'd need to use it to default the value of the dropdownlist to the current value.

    Function GetStatus() as DataSet

    Dim DBConn as OleDbConnection
    Dim DBCommand as OleDbDataAdapter
    
    		
    DBConn = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("data/Auto\_log.mdb") & ";")
    DBCommand = New OleDbDataAdapter("SELECT StatusID, Status from Status ORDER BY Status", DBConn)
    
    
    DBCommand.Fill(DS, "Status")
    DBConn.Close()
    
    Return DS
    

    End Function

    Function GetSelectedIndex(ByVal StatusID As String) As Integer
        'Loop through the DataSet DS
        Dim iLoop As Integer
        Dim DT As DataTable = DS.Tables("Status")
        For iLoop = 0 To DT.Rows.Count - 1
            If StatusID = DT.Rows(iLoop)("StatusID").ToString Then
                Return iLoop
            End If
        Next iLoop
    End Function
    

    I then declare the ddl in my update subroutine as follows

    Dim ddlStatus As DropDownList = FindControl("ddlStatusctrl")

    and here is the ddl control from my datagrid:

    Status		
    
    
    <%# Container.DataItem("Status") %>
    

    Rob

    ASP.NET database help question announcement

  • Datagrid Dropdownlist
    R robw1888

    Hi all, My apologies if this is an easy one (v.new to this!) but I get the following error when clicking edit a datagrid with a dropdownlist. 'System.IndexOutOfRangeException: StatusID' In my datagrid I'm calling functions in VB. One to get the status and populate a Dataset & one to get selected index so I can set the initial value of the dropdownlist. I then have the update sub to declare the dropdownlist and and update the database. Would anyone be able to point me in the right direction? Many Thanks

    Rob

    ASP.NET database help question announcement

  • Datagrid dropdownlist, populated from Access database. [modified]
    R robw1888

    Hi all, First of all I'll apologise in advance! I'm very new to this and have been trying to learn through books and what I can pick up on the net so I'm hoping someone can help me understand where I'm going wrong with the following... I've set up a datagrid which works perfectly when I use textboxes, however I'm trying to limit user choice by adding dropdownlists to the datagrid. I get as far as clicking to edit the field and get the following error: --------------------------- System.IndexOutOfRangeException: StatusID Source Error: Line 345: Line 346: Line 347: Status <%# Container.DataItem("Status") %> and VB code is : to populate the dataset ('Dim DS as DataSet = New DataSet()' declared globally) ... Function GetStatus() as DataSet Dim DBConn as OleDbConnection Dim DBCommand as OleDbDataAdapter DBConn = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & Server.MapPath("data/Auto_log.mdb") & ";") DBCommand = New OleDbDataAdapter("SELECT StatusID, Status from Status ORDER BY Status", DBConn) DBCommand.Fill(DS, "Status") DBConn.Close() Return DS End Function ---------------- to get selected index - Function GetSelectedIndex(ByVal StatusID As String) As Integer 'Loop through the DataSet DS Dim iLoop As Integer Dim DT As DataTable = DS.Tables("Status") For iLoop = 0 To DT.Rows.Count - 1 If StatusID = DT.Rows(iLoop)("StatusID").ToString Then Return iLoop End If Next iLoop End Function ----------- ... & to update the database (cut to show coding related to ddl)- Sub dg_Update(s As Object, e As DataGridCommandEventArgs)

    Visual Basic database help sysadmin docker announcement
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups