page index changed accessing dataadapter
-
I have a data adapter I create in another procedure and I am trying to access that specific data adapter in the page_index_changed event for the datagrid on the page, but I am unaware how to gain access to that adapter and dataset... Got any ideas? Thanks "Nothing is at last sacred, but the integrity of your own mind." "What lies behind us and what lies before us are nothing compared to what lies within us." - Ralph Waldo Emerson
-
I have a data adapter I create in another procedure and I am trying to access that specific data adapter in the page_index_changed event for the datagrid on the page, but I am unaware how to gain access to that adapter and dataset... Got any ideas? Thanks "Nothing is at last sacred, but the integrity of your own mind." "What lies behind us and what lies before us are nothing compared to what lies within us." - Ralph Waldo Emerson
-
so if I make that adapter public above... then how would I define the select command and connection in the other procedures? public da2 as new oledbdataadapter would the select be like this: da2.selectcommand.commandtext = "whatever" ?? that is my best guess there but I dont know about the connection... Thank you!!! "Nothing is at last sacred, but the integrity of your own mind." "What lies behind us and what lies before us are nothing compared to what lies within us." - Ralph Waldo Emerson
-
so if I make that adapter public above... then how would I define the select command and connection in the other procedures? public da2 as new oledbdataadapter would the select be like this: da2.selectcommand.commandtext = "whatever" ?? that is my best guess there but I dont know about the connection... Thank you!!! "Nothing is at last sacred, but the integrity of your own mind." "What lies behind us and what lies before us are nothing compared to what lies within us." - Ralph Waldo Emerson
-
so if I make that adapter public above... then how would I define the select command and connection in the other procedures? public da2 as new oledbdataadapter would the select be like this: da2.selectcommand.commandtext = "whatever" ?? that is my best guess there but I dont know about the connection... Thank you!!! "Nothing is at last sacred, but the integrity of your own mind." "What lies behind us and what lies before us are nothing compared to what lies within us." - Ralph Waldo Emerson
-
Marcie, I tried to make those guys public and work with them so I can throw some stuff together (I will encapsulate later) and i am getting this error: System.NullReferenceException: Object reference not set to an instance of an object Here is code: Imports System.Data.OleDb Public Class vqmResults1 Inherits System.Web.UI.Page #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. Private Sub InitializeComponent() End Sub Protected WithEvents Label1 As System.Web.UI.WebControls.Label Protected WithEvents Label2 As System.Web.UI.WebControls.Label Protected WithEvents Label3 As System.Web.UI.WebControls.Label Protected WithEvents Label4 As System.Web.UI.WebControls.Label Protected WithEvents lblOtherStartDate As System.Web.UI.WebControls.Label Protected WithEvents Label5 As System.Web.UI.WebControls.Label Protected WithEvents lblOtherEndDate As System.Web.UI.WebControls.Label Protected WithEvents txtOtherOpCode As System.Web.UI.WebControls.TextBox Protected WithEvents txtOtherVendor As System.Web.UI.WebControls.TextBox Protected WithEvents btnGetData As System.Web.UI.WebControls.Button Protected WithEvents dg As System.Web.UI.WebControls.DataGrid Protected WithEvents Label6 As System.Web.UI.WebControls.Label Protected WithEvents txtOpCode2 As System.Web.UI.WebControls.TextBox 'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceholderDeclaration As System.Object 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 Public da As New OleDbDataAdapter Public ds As New DataSet Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here Dim OpCode As String Dim Vendor As String Dim StartDate As String Dim EndDate As String If Not Page.IsPostBack Then If Request.QueryString("oc") <> "" And Request.QueryString("vnd") <> "" And Request.QueryString("sdate") <> "" And Request.QueryString("edate") <> "" Then txtOtherOpCode.Text(
-
Marcie, Have a little trouble creating a function to make the connection and configure adapter.. Can you help me out, please? Forgive me, Im a newbie... Public Sub MakeConnection(ByVal sqlSelect As String) Dim strConn As New OleDbConnection("Provider=""MSDAORA.1"";User ID=whatever;Data Source=VQM;Password=whatever") Dim da As New OleDbDataAdapter(sqlSelect, strConn) 'Dim ds As New DataSet strConn.Open() da.Fill(ds, "VENDORDESC") strConn.Close() End Sub My logic was going to be to take in a string as a parameter that would be the sql statment. Then I would populate the public dataset. Then in the Page_Index_Changed (for example) I would call MakeConnection(whatever), which would populate that dataset and then I would bind the datagrid. I could be way off here... If I am not way off... why does the Page_Load and other methods/events in the class not recognize the MakeConnection function as being defined? Also, aside from making the sqlSelect a public variable... how would I use that as to be able to have the Page_Load logic create the sql string and have it also used in the Page_Index_Changed event? Thanks for the help!! cavall "Nothing is at last sacred, but the integrity of your own mind." "What lies behind us and what lies before us are nothing compared to what lies within us." - Ralph Waldo Emerson