Ask a Question related to ASP.NET General, Design and Development.
-
Helixpoint #1
Looking for a quicker way to fill a datagrid???
Here is my code:
Dim availMach As New ASPNETProduct.machinedb()
Dim dstMachList As DataSet
dstMachList = availMach.GetAvailMach(theSearchVal, theSearchBy,
theMachCode1, theSearchView, SelSort, SelSortDir)
availMachList.DataSource = dstMachList
Public Function GetAvailMach(ByVal theSearchVal As String, ByVal theSearchBy
As String, ByVal MACH_CODE1 As String, ByVal theSearchView As String, ByVal
SelSort As String, ByVal SelSortDir As String) As DataSet
' Create Instance of Connection and Command Object
Dim myConnection As New
SqlConnection(ConfigurationSettings.AppSettings("c onnectionString"))
Dim myCommand As New SqlDataAdapter("SelectOpenInventory", myConnection)
' Mark the Command as a SPROC
myCommand.SelectCommand.CommandType = CommandType.StoredProcedure
' Add Parameters to SPROC
Dim parametertheSearchVal As New SqlParameter("@theSearchVal",
SqlDbType.NVarChar, 100)
parametertheSearchVal.Value = theSearchVal
myCommand.SelectCommand.Parameters.Add(parameterth eSearchVal)
Dim parametertheSearchBy As New SqlParameter("@theSearchBy",
SqlDbType.NVarChar, 100)
parametertheSearchBy.Value = theSearchBy
myCommand.SelectCommand.Parameters.Add(parameterth eSearchBy)
Dim parameterMACH_CODE1 As New SqlParameter("@MACH_CODE",
SqlDbType.NVarChar, 50)
parameterMACH_CODE1.Value = MACH_CODE1
myCommand.SelectCommand.Parameters.Add(parameterMA CH_CODE1)
Dim parametertheSearchView As New SqlParameter("@theSearchView",
SqlDbType.NVarChar, 50)
parametertheSearchView.Value = theSearchView
myCommand.SelectCommand.Parameters.Add(parameterth eSearchView)
Dim parameterSelSort As New SqlParameter("@SelSort", SqlDbType.NVarChar, 50)
parameterSelSort.Value = SelSort
myCommand.SelectCommand.Parameters.Add(parameterSe lSort)
Dim parameterSelSortDir As New SqlParameter("@SelSortDir",
SqlDbType.NVarChar, 10)
parameterSelSortDir.Value = SelSortDir
myCommand.SelectCommand.Parameters.Add(parameterSe lSortDir)
' Create and Fill the DataSet
Dim myDataSet As New DataSet
myCommand.Fill(myDataSet)
' Return the datareader
Return myDataSet
End Function
--
dave
Helixpoint Guest
-
Fill a Dropdownlist in Datagrid template field based on the Row
Basically I want to be able to do this: Have a Datagrid/DataList of Employees and the Dropdownlist will have their family member names that they... -
fill datagrid
if i have two or more datagrids need to be filled , should i use two or more sqldataadapters, or only just use one sqldataadapter (by changing it's... -
editing text in swf using Sothink SWF Quicker
Could someone enlighten me on how I can edit existing text in an existing SWF file using Sothink SWF Quicker? I am not a Flash developer, but I... -
Quicker Flash sites?
Hi FYI - I just put up a brand new copy of Optimaze on http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=3616101286&ssPageName=ADME:B:LC:US:1 -... -
Fill datagrid without database
Hello I need to fill in my datagrid from calcutalted date. how do I fill in my datagrid? yoramo -
Alvin Bruney #2
Re: Looking for a quicker way to fill a datagrid???
if fill is not fast enough for you, use a datareader to loop thru. remember
the reader is a fire hose cursor and you have to explicitly close it when
done or else it is considered blocked.
"Helixpoint" <dave@helixpoint.com> wrote in message
news:eew7dGqVDHA.3332@tk2msftngp13.phx.gbl...theSearchBy> Here is my code:
>
> Dim availMach As New ASPNETProduct.machinedb()
>
> Dim dstMachList As DataSet
>
> dstMachList = availMach.GetAvailMach(theSearchVal, theSearchBy,
> theMachCode1, theSearchView, SelSort, SelSortDir)
>
> availMachList.DataSource = dstMachList
>
>
>
>
>
> Public Function GetAvailMach(ByVal theSearchVal As String, ByValByVal> As String, ByVal MACH_CODE1 As String, ByVal theSearchView As String,50)> SelSort As String, ByVal SelSortDir As String) As DataSet
>
> ' Create Instance of Connection and Command Object
>
> Dim myConnection As New
> SqlConnection(ConfigurationSettings.AppSettings("c onnectionString"))
>
> Dim myCommand As New SqlDataAdapter("SelectOpenInventory", myConnection)
>
> ' Mark the Command as a SPROC
>
> myCommand.SelectCommand.CommandType = CommandType.StoredProcedure
>
> ' Add Parameters to SPROC
>
> Dim parametertheSearchVal As New SqlParameter("@theSearchVal",
> SqlDbType.NVarChar, 100)
>
> parametertheSearchVal.Value = theSearchVal
>
> myCommand.SelectCommand.Parameters.Add(parameterth eSearchVal)
>
> Dim parametertheSearchBy As New SqlParameter("@theSearchBy",
> SqlDbType.NVarChar, 100)
>
> parametertheSearchBy.Value = theSearchBy
>
> myCommand.SelectCommand.Parameters.Add(parameterth eSearchBy)
>
>
>
> Dim parameterMACH_CODE1 As New SqlParameter("@MACH_CODE",
> SqlDbType.NVarChar, 50)
>
> parameterMACH_CODE1.Value = MACH_CODE1
>
> myCommand.SelectCommand.Parameters.Add(parameterMA CH_CODE1)
>
>
>
> Dim parametertheSearchView As New SqlParameter("@theSearchView",
> SqlDbType.NVarChar, 50)
>
> parametertheSearchView.Value = theSearchView
>
> myCommand.SelectCommand.Parameters.Add(parameterth eSearchView)
>
> Dim parameterSelSort As New SqlParameter("@SelSort", SqlDbType.NVarChar,>
> parameterSelSort.Value = SelSort
>
> myCommand.SelectCommand.Parameters.Add(parameterSe lSort)
>
> Dim parameterSelSortDir As New SqlParameter("@SelSortDir",
> SqlDbType.NVarChar, 10)
>
> parameterSelSortDir.Value = SelSortDir
>
> myCommand.SelectCommand.Parameters.Add(parameterSe lSortDir)
>
>
>
>
>
> ' Create and Fill the DataSet
>
> Dim myDataSet As New DataSet
>
> myCommand.Fill(myDataSet)
>
> ' Return the datareader
>
> Return myDataSet
>
> End Function
>
>
> --
>
> dave
>
>
Alvin Bruney Guest
-
John Saunders #3
Re: Looking for a quicker way to fill a datagrid???
How much faster would a DataReader be? Doesn't Fill use a DataReader to fill
the DataSet?
--
John Saunders
Internet Engineer
[email]john.saunders@surfcontrol.com[/email]
"Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com > wrote in
message news:%23NBbzL4VDHA.1180@TK2MSFTNGP11.phx.gbl...remember> if fill is not fast enough for you, use a datareader to loop thru.> the reader is a fire hose cursor and you have to explicitly close it when
> done or else it is considered blocked.
>
> "Helixpoint" <dave@helixpoint.com> wrote in message
> news:eew7dGqVDHA.3332@tk2msftngp13.phx.gbl...> theSearchBy> > Here is my code:
> >
> > Dim availMach As New ASPNETProduct.machinedb()
> >
> > Dim dstMachList As DataSet
> >
> > dstMachList = availMach.GetAvailMach(theSearchVal, theSearchBy,
> > theMachCode1, theSearchView, SelSort, SelSortDir)
> >
> > availMachList.DataSource = dstMachList
> >
> >
> >
> >
> >
> > Public Function GetAvailMach(ByVal theSearchVal As String, ByVal> ByVal> > As String, ByVal MACH_CODE1 As String, ByVal theSearchView As String,> 50)> > SelSort As String, ByVal SelSortDir As String) As DataSet
> >
> > ' Create Instance of Connection and Command Object
> >
> > Dim myConnection As New
> > SqlConnection(ConfigurationSettings.AppSettings("c onnectionString"))
> >
> > Dim myCommand As New SqlDataAdapter("SelectOpenInventory", myConnection)
> >
> > ' Mark the Command as a SPROC
> >
> > myCommand.SelectCommand.CommandType = CommandType.StoredProcedure
> >
> > ' Add Parameters to SPROC
> >
> > Dim parametertheSearchVal As New SqlParameter("@theSearchVal",
> > SqlDbType.NVarChar, 100)
> >
> > parametertheSearchVal.Value = theSearchVal
> >
> > myCommand.SelectCommand.Parameters.Add(parameterth eSearchVal)
> >
> > Dim parametertheSearchBy As New SqlParameter("@theSearchBy",
> > SqlDbType.NVarChar, 100)
> >
> > parametertheSearchBy.Value = theSearchBy
> >
> > myCommand.SelectCommand.Parameters.Add(parameterth eSearchBy)
> >
> >
> >
> > Dim parameterMACH_CODE1 As New SqlParameter("@MACH_CODE",
> > SqlDbType.NVarChar, 50)
> >
> > parameterMACH_CODE1.Value = MACH_CODE1
> >
> > myCommand.SelectCommand.Parameters.Add(parameterMA CH_CODE1)
> >
> >
> >
> > Dim parametertheSearchView As New SqlParameter("@theSearchView",
> > SqlDbType.NVarChar, 50)
> >
> > parametertheSearchView.Value = theSearchView
> >
> > myCommand.SelectCommand.Parameters.Add(parameterth eSearchView)
> >
> > Dim parameterSelSort As New SqlParameter("@SelSort", SqlDbType.NVarChar,>> >
> > parameterSelSort.Value = SelSort
> >
> > myCommand.SelectCommand.Parameters.Add(parameterSe lSort)
> >
> > Dim parameterSelSortDir As New SqlParameter("@SelSortDir",
> > SqlDbType.NVarChar, 10)
> >
> > parameterSelSortDir.Value = SelSortDir
> >
> > myCommand.SelectCommand.Parameters.Add(parameterSe lSortDir)
> >
> >
> >
> >
> >
> > ' Create and Fill the DataSet
> >
> > Dim myDataSet As New DataSet
> >
> > myCommand.Fill(myDataSet)
> >
> > ' Return the datareader
> >
> > Return myDataSet
> >
> > End Function
> >
> >
> > --
> >
> > dave
> >
> >
>
John Saunders Guest
-
Alvin Bruney #4
Re: Looking for a quicker way to fill a datagrid???
underneath it does but there is a lot of extra overhead because the results
have to be packaged and stuffed into a dataset. the performance difference
is night and day.
"John Saunders" <john.saunders@surfcontrol.com> wrote in message
news:eHUbYl4VDHA.484@TK2MSFTNGP09.phx.gbl...fill> How much faster would a DataReader be? Doesn't Fill use a DataReader towhen> the DataSet?
> --
> John Saunders
> Internet Engineer
> [email]john.saunders@surfcontrol.com[/email]
>
> "Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com > wrote in
> message news:%23NBbzL4VDHA.1180@TK2MSFTNGP11.phx.gbl...> remember> > if fill is not fast enough for you, use a datareader to loop thru.> > the reader is a fire hose cursor and you have to explicitly close itmyConnection)> > done or else it is considered blocked.
> >
> > "Helixpoint" <dave@helixpoint.com> wrote in message
> > news:eew7dGqVDHA.3332@tk2msftngp13.phx.gbl...> > theSearchBy> > > Here is my code:
> > >
> > > Dim availMach As New ASPNETProduct.machinedb()
> > >
> > > Dim dstMachList As DataSet
> > >
> > > dstMachList = availMach.GetAvailMach(theSearchVal, theSearchBy,
> > > theMachCode1, theSearchView, SelSort, SelSortDir)
> > >
> > > availMachList.DataSource = dstMachList
> > >
> > >
> > >
> > >
> > >
> > > Public Function GetAvailMach(ByVal theSearchVal As String, ByVal> > ByVal> > > As String, ByVal MACH_CODE1 As String, ByVal theSearchView As String,> > > SelSort As String, ByVal SelSortDir As String) As DataSet
> > >
> > > ' Create Instance of Connection and Command Object
> > >
> > > Dim myConnection As New
> > > SqlConnection(ConfigurationSettings.AppSettings("c onnectionString"))
> > >
> > > Dim myCommand As New SqlDataAdapter("SelectOpenInventory",SqlDbType.NVarChar,> > >
> > > ' Mark the Command as a SPROC
> > >
> > > myCommand.SelectCommand.CommandType = CommandType.StoredProcedure
> > >
> > > ' Add Parameters to SPROC
> > >
> > > Dim parametertheSearchVal As New SqlParameter("@theSearchVal",
> > > SqlDbType.NVarChar, 100)
> > >
> > > parametertheSearchVal.Value = theSearchVal
> > >
> > > myCommand.SelectCommand.Parameters.Add(parameterth eSearchVal)
> > >
> > > Dim parametertheSearchBy As New SqlParameter("@theSearchBy",
> > > SqlDbType.NVarChar, 100)
> > >
> > > parametertheSearchBy.Value = theSearchBy
> > >
> > > myCommand.SelectCommand.Parameters.Add(parameterth eSearchBy)
> > >
> > >
> > >
> > > Dim parameterMACH_CODE1 As New SqlParameter("@MACH_CODE",
> > > SqlDbType.NVarChar, 50)
> > >
> > > parameterMACH_CODE1.Value = MACH_CODE1
> > >
> > > myCommand.SelectCommand.Parameters.Add(parameterMA CH_CODE1)
> > >
> > >
> > >
> > > Dim parametertheSearchView As New SqlParameter("@theSearchView",
> > > SqlDbType.NVarChar, 50)
> > >
> > > parametertheSearchView.Value = theSearchView
> > >
> > > myCommand.SelectCommand.Parameters.Add(parameterth eSearchView)
> > >
> > > Dim parameterSelSort As New SqlParameter("@SelSort",>> > 50)> >> > >
> > > parameterSelSort.Value = SelSort
> > >
> > > myCommand.SelectCommand.Parameters.Add(parameterSe lSort)
> > >
> > > Dim parameterSelSortDir As New SqlParameter("@SelSortDir",
> > > SqlDbType.NVarChar, 10)
> > >
> > > parameterSelSortDir.Value = SelSortDir
> > >
> > > myCommand.SelectCommand.Parameters.Add(parameterSe lSortDir)
> > >
> > >
> > >
> > >
> > >
> > > ' Create and Fill the DataSet
> > >
> > > Dim myDataSet As New DataSet
> > >
> > > myCommand.Fill(myDataSet)
> > >
> > > ' Return the datareader
> > >
> > > Return myDataSet
> > >
> > > End Function
> > >
> > >
> > > --
> > >
> > > dave
> > >
> > >
> >
>
Alvin Bruney Guest
-
John Saunders #5
Re: Looking for a quicker way to fill a datagrid???
Interesting. I'll have to do some performance tests on that some day. I had
thought that, absent DataRelations, they'd just loop through the DataReader,
calling:
DataSet ds = something();
DataTable dt = ds.Tables[0];
DataReader reader = somethingElse();
while (reader.Read())
{
DataRow dr = dt.NewRow();
dr.ItemArray = reader.GetValues();
dt.Rows.Add(dr);
}
Oh, well, one more mystery...
--
John Saunders
Internet Engineer
[email]john.saunders@surfcontrol.com[/email]
"Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com > wrote in
message news:ueZbU5%23VDHA.1180@TK2MSFTNGP11.phx.gbl...results> underneath it does but there is a lot of extra overhead because thein> have to be packaged and stuffed into a dataset. the performance difference
> is night and day.
>
> "John Saunders" <john.saunders@surfcontrol.com> wrote in message
> news:eHUbYl4VDHA.484@TK2MSFTNGP09.phx.gbl...> fill> > How much faster would a DataReader be? Doesn't Fill use a DataReader to> > the DataSet?
> > --
> > John Saunders
> > Internet Engineer
> > [email]john.saunders@surfcontrol.com[/email]
> >
> > "Alvin Bruney" <vapordan_spam_me_not@hotmail_no_spamhotmail.com > wroteString,> when> > message news:%23NBbzL4VDHA.1180@TK2MSFTNGP11.phx.gbl...> > remember> > > if fill is not fast enough for you, use a datareader to loop thru.> > > the reader is a fire hose cursor and you have to explicitly close it> > > done or else it is considered blocked.
> > >
> > > "Helixpoint" <dave@helixpoint.com> wrote in message
> > > news:eew7dGqVDHA.3332@tk2msftngp13.phx.gbl...
> > > > Here is my code:
> > > >
> > > > Dim availMach As New ASPNETProduct.machinedb()
> > > >
> > > > Dim dstMachList As DataSet
> > > >
> > > > dstMachList = availMach.GetAvailMach(theSearchVal, theSearchBy,
> > > > theMachCode1, theSearchView, SelSort, SelSortDir)
> > > >
> > > > availMachList.DataSource = dstMachList
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Public Function GetAvailMach(ByVal theSearchVal As String, ByVal
> > > theSearchBy
> > > > As String, ByVal MACH_CODE1 As String, ByVal theSearchView As> myConnection)> > > ByVal
> > > > SelSort As String, ByVal SelSortDir As String) As DataSet
> > > >
> > > > ' Create Instance of Connection and Command Object
> > > >
> > > > Dim myConnection As New
> > > > SqlConnection(ConfigurationSettings.AppSettings("c onnectionString"))
> > > >
> > > > Dim myCommand As New SqlDataAdapter("SelectOpenInventory",> SqlDbType.NVarChar,> > > >
> > > > ' Mark the Command as a SPROC
> > > >
> > > > myCommand.SelectCommand.CommandType = CommandType.StoredProcedure
> > > >
> > > > ' Add Parameters to SPROC
> > > >
> > > > Dim parametertheSearchVal As New SqlParameter("@theSearchVal",
> > > > SqlDbType.NVarChar, 100)
> > > >
> > > > parametertheSearchVal.Value = theSearchVal
> > > >
> > > > myCommand.SelectCommand.Parameters.Add(parameterth eSearchVal)
> > > >
> > > > Dim parametertheSearchBy As New SqlParameter("@theSearchBy",
> > > > SqlDbType.NVarChar, 100)
> > > >
> > > > parametertheSearchBy.Value = theSearchBy
> > > >
> > > > myCommand.SelectCommand.Parameters.Add(parameterth eSearchBy)
> > > >
> > > >
> > > >
> > > > Dim parameterMACH_CODE1 As New SqlParameter("@MACH_CODE",
> > > > SqlDbType.NVarChar, 50)
> > > >
> > > > parameterMACH_CODE1.Value = MACH_CODE1
> > > >
> > > > myCommand.SelectCommand.Parameters.Add(parameterMA CH_CODE1)
> > > >
> > > >
> > > >
> > > > Dim parametertheSearchView As New SqlParameter("@theSearchView",
> > > > SqlDbType.NVarChar, 50)
> > > >
> > > > parametertheSearchView.Value = theSearchView
> > > >
> > > > myCommand.SelectCommand.Parameters.Add(parameterth eSearchView)
> > > >
> > > > Dim parameterSelSort As New SqlParameter("@SelSort",>> >> > > 50)
> > > >
> > > > parameterSelSort.Value = SelSort
> > > >
> > > > myCommand.SelectCommand.Parameters.Add(parameterSe lSort)
> > > >
> > > > Dim parameterSelSortDir As New SqlParameter("@SelSortDir",
> > > > SqlDbType.NVarChar, 10)
> > > >
> > > > parameterSelSortDir.Value = SelSortDir
> > > >
> > > > myCommand.SelectCommand.Parameters.Add(parameterSe lSortDir)
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > ' Create and Fill the DataSet
> > > >
> > > > Dim myDataSet As New DataSet
> > > >
> > > > myCommand.Fill(myDataSet)
> > > >
> > > > ' Return the datareader
> > > >
> > > > Return myDataSet
> > > >
> > > > End Function
> > > >
> > > >
> > > > --
> > > >
> > > > dave
> > > >
> > > >
> > >
> > >
> >
>
John Saunders Guest



Reply With Quote

