473,425 Members | 1,577 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,425 software developers and data experts.

Data in dataset but not displaying in gridview

Hello, I'm new to this asp.net 2.0 I need help??
My database is coming from AS400 which uses odbc Commands. i have data in the dataset but nothing showing in my gridview. However the data does show on the page. Could you please see what I'm doing wrong.

My code is down below
Expand|Select|Wrap|Line Numbers
  1.  Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
  2.  
  3.  
  4.         Dim myconnection As OdbcConnection
  5.         Dim myCommand As OdbcDataAdapter
  6.         Dim mydataset As New DataSet
  7.         Dim gvResults As DataTable
  8.         Dim loop1 As Integer
  9.         Dim numrows As Integer
  10.         Dim mysql As String
  11.         Dim Order As Integer
  12.         Order = CInt(txtOrderNumber.Text)
  13.  
  14.  
  15.         mysql = "select  line#, ordno, quano, quana, quans, c2rdt, unitm, prdno, actsp  from rmsfiles2.obcop200 where ordno = " & Order
  16.         myconnection = New OdbcConnection("DRIVER=Client Access ODBC Driver (32-bit);UID=ODBC;PWD=XXXXX;System=xxx.xxx.xxx.xxx")
  17.  
  18.         myCommand = New OdbcDataAdapter(mysql, myconnection)
  19.  
  20.         myCommand.Fill(mydataset, "OBCOP200")
  21.  
  22.         gvResults = New DataTable
  23.         gvResults = mydataset.Tables(0)
  24.  
  25.         numrows = gvResults.Rows.Count
  26.  
  27.         If numrows = 0 Then
  28.             txtOrderNumber.Text = "Order#" & txtOrderNumber.Text & " invalid order number"
  29.  
  30.         Else
  31.             txtOrderNumber.Text = ""
  32.  
  33.             For loop1 = 0 To numrows - 1
  34.  
  35.                 Response.Write(Server.HtmlEncode(gvResults.Rows(loop1).Item("ordno")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("quano")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("quana")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("quans")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("c2rdt")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("unitm")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("prdno")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("actsp")) & " <br>")
  36.  
  37.  
  38.             Next loop1
  39.             gridview1.DataBind()
  40.         End If
  41.  
  42.         gridview1.DataSource = mydataset.Tables("OBCOP200").DefaultView
  43.         gridview1.DataBind()
  44.         gridview1.Visible = True
Sep 11 '07 #1
51 7821
Frinavale
9,735 Expert Mod 8TB
Hi Kjewell23,

I've moved your question to the .NET Forum.
The .NET Articles section is reserved for "how-tos" and other helpful tips and is not meant for questions. In the future please post your questions in the .NET Forum (Blue menu at top: Forums -> .NET).

Also, it is not a good idea to post your IP's with your code.
I've edited your post to remove the IP.

Thanks!

-Frinny
Sep 11 '07 #2
Frinavale
9,735 Expert Mod 8TB
Hello, I'm new to this asp.net 2.0 I need help??
My database is coming from AS400 which uses odbc Commands. i have data in the dataset but nothing showing in my gridview. However the data does show on the page. Could you please see what I'm doing wrong. ....
What do you mean that it shows up on the page?
Sep 11 '07 #3
What do you mean that it shows up on the page?
The data shows up on the top of the page but it pushes everything down like the title of the page, textbox, and button. Here i show you want I mean

Down below

600452 1.000 0 1.000 9/25/2006 EA 06759055 30.450 ( this is the data)


(title)Order Detail Inquiry

Order Number(label) textbox here (submit button here)
Sep 11 '07 #4
Hi jewell,,

I would suggest to remove part of the code that i am pasting here and replace with what i am giving here.

Remove this :
Expand|Select|Wrap|Line Numbers
  1.  
  2. #
  3. If numrows = 0 Then
  4. #
  5.             txtOrderNumber.Text = "Order#" & txtOrderNumber.Text & " invalid order number"
  6. #
  7.  
  8. #
  9.         Else
  10. #
  11.             txtOrderNumber.Text = ""
  12. #
  13.  
  14. #
  15.             For loop1 = 0 To numrows - 1
  16. #
  17.  
  18. #
  19.                 Response.Write(Server.HtmlEncode(gvResults.Rows(lo  op1).Item("ordno")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("quano")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("quana")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("quans")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("c2rdt")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("unitm")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("prdno")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("actsp")) & " <br>")
  20. #
  21.  
  22. #
  23.  
  24. #
  25.             Next loop1
  26. #
  27.             gridview1.DataBind()
  28. #
  29.         End If
  30. #
  31.  
  32. #
  33.         gridview1.DataSource = mydataset.Tables("OBCOP200").DefaultView
  34.  
Replace it with.
Expand|Select|Wrap|Line Numbers
  1. gridview1.DataSource = mydataset.Tables("OBCOP200")
  2.  
and let me know how it went.

thanks

Samir
Sep 11 '07 #5
Frinavale
9,735 Expert Mod 8TB
The data shows up on the top of the page but it pushes everything down like the title of the page, textbox, and button. Here i show you want I mean

Down below

600452 1.000 0 1.000 9/25/2006 EA 06759055 30.450 ( this is the data)


(title)Order Detail Inquiry

Order Number(label) textbox here (submit button here)
Oh ok, that's because of the Response.Write that you have there...sorry for some reason I skipped over that whole bit of code...taking a closer look at your code now.

Try removing the gridview1.DataBind() from Here:
Expand|Select|Wrap|Line Numbers
  1.  
  2.         If numrows = 0 Then
  3.             txtOrderNumber.Text = "Order#" & txtOrderNumber.Text & " invalid order number"
  4.  
  5.         Else
  6.             txtOrderNumber.Text = ""
  7.  
  8.             For loop1 = 0 To numrows - 1
  9.  
  10.                 Response.Write(Server.HtmlEncode(gvResults.Rows(loop1).Item("ordno")) & " " & Server.HtmlEncode(g        gridview1.DataSource = mydataset.Tables("OBCOP200").DefaultView
  11.         gridview1.DataBind()
  12.         gridview1.Visible = True
  13.  
  14.  
  15. vResults.Rows(loop1).Item("quano")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("quana")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("quans")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("c2rdt")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("unitm")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("prdno")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("actsp")) & " <br>")
  16.  
  17.  
  18.             Next loop1
  19.   'remove ------>          gridview1.DataBind()
  20.         End If

And try making this change as well:
Expand|Select|Wrap|Line Numbers
  1. gridview1.DataSource = mydataset
  2. gridview1.DataBind()
  3. gridview1.Visible = True
  4.  
It may be that it can't find
Expand|Select|Wrap|Line Numbers
  1.   gridview1.DataSource = mydataset.Tables("OBCOP200").DefaultView
-Frinny
Sep 11 '07 #6
Ok that didn't work It shows nothing.
Hi jewell,,

I would suggest to remove part of the code that i am pasting here and replace with what i am giving here.

Remove this :

#
If numrows = 0 Then
#
txtOrderNumber.Text = "Order#" & txtOrderNumber.Text & " invalid order number"
#

#
Else
#
txtOrderNumber.Text = ""
#

#
For loop1 = 0 To numrows - 1
#

#
Response.Write(Server.HtmlEncode(gvResults.Rows(lo op1).Item("ordno")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("quan o")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("quan a")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("quan s")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("c2rd t")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("unit m")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("prdn o")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("acts p")) & " <br>")
#

#

#
Next loop1
#
gridview1.DataBind()
#
End If
#

#
gridview1.DataSource = mydataset.Tables("OBCOP200").DefaultView


Replace it with.

gridview1.DataSource = mydataset.Tables("OBCOP200")

and let me know how it went.

thanks

Samir
Sep 11 '07 #7
So just take out the gridview1.databind() in the next loop1 section


Oh ok, that's because of the Response.Write that you have there...sorry for some reason I skipped over that whole bit of code...taking a closer look at your code now.

Try removing the gridview1.DataBind() from Here:
Expand|Select|Wrap|Line Numbers
  1.  
  2.         If numrows = 0 Then
  3.             txtOrderNumber.Text = "Order#" & txtOrderNumber.Text & " invalid order number"
  4.  
  5.         Else
  6.             txtOrderNumber.Text = ""
  7.  
  8.             For loop1 = 0 To numrows - 1
  9.  
  10.                 Response.Write(Server.HtmlEncode(gvResults.Rows(loop1).Item("ordno")) & " " & Server.HtmlEncode(g        gridview1.DataSource = mydataset.Tables("OBCOP200").DefaultView
  11.         gridview1.DataBind()
  12.         gridview1.Visible = True
  13.  
  14.  
  15. vResults.Rows(loop1).Item("quano")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("quana")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("quans")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("c2rdt")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("unitm")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("prdno")) & " " & Server.HtmlEncode(gvResults.Rows(loop1).Item("actsp")) & " <br>")
  16.  
  17.  
  18.             Next loop1
  19.   'remove ------>          gridview1.DataBind()
  20.         End If

And try making this change as well:
Expand|Select|Wrap|Line Numbers
  1. gridview1.DataSource = mydataset
  2. gridview1.DataBind()
  3. gridview1.Visible = True
  4.  
It may be that it can't find
Expand|Select|Wrap|Line Numbers
  1.   gridview1.DataSource = mydataset.Tables("OBCOP200").DefaultView
-Frinny
Sep 11 '07 #8
Frinavale
9,735 Expert Mod 8TB
So just take out the gridview1.databind() in the next loop1 section
Yes and take out the .Tables("...").DefaultView from:
Expand|Select|Wrap|Line Numbers
  1. gridview1.DataSource = mydataset.Tables("OBCOP200").DefaultView
  2.  
I have a feeling you're looking up a table in your data set that doesn't exist...
Sep 11 '07 #9
Plater
7,872 Expert 4TB
Using Response.Write() is discouraged if you have controls on the page as using it can cause unknown/undesired results.
You should use an ASP:Label or ASP:Panel and write the text inside those instead.

Also, there a few things that could cause no data to be displayed:
  • Configurable display options for gridview are set to hide data
  • Cycling through the DataTable with that lookp is marking the data "read" and the gridview sees that (very unlikely)
  • Nameing the DataTable with a TableName is causing some confusion and the gridview is only getting to look at an empty table because of it.
  • Also, I would have to check, but try taking out the ".DefaultView", since gridviews want a table not a view. (I always just use the Table)

You can use the DataAdapter to populate a DataTable directly rather then a DataSet if you wanted.
Sep 11 '07 #10
Frinavale
9,735 Expert Mod 8TB
Using Response.Write() is discouraged if you have controls on the page as using it can cause unknown/undesired results.
You should use an ASP:Label or ASP:Panel and write the text inside those instead.

Also, there a few things that could cause no data to be displayed:
  • Configurable display options for gridview are set to hide data
  • Cycling through the DataTable with that lookp is marking the data "read" and the gridview sees that (very unlikely)
  • Nameing the DataTable with a TableName is causing some confusion and the gridview is only getting to look at an empty table because of it.
  • Also, I would have to check, but try taking out the ".DefaultView", since gridviews want a table not a view. (I always just use the Table)

You can use the DataAdapter to populate a DataTable directly rather then a DataSet if you wanted.
I thought that the Response.Write bit was for debugging purposes....
Am I wrong here???
Sep 11 '07 #11
i did that and it still displays but not in gridview. It shows that I have three rows in the part where if numrows and on down . When I debug it it shows system. dataset where the fill command is and then it shows mydataset.Tables = {System.Data.DataTableCollection} at gvResults = (where the datatable is)
then it has the number of rows in if then and then it has the number that i typed inside the text box also in the else then it through the loop 23 times before displaying it. and then finally it shows at gridview1.DataSource = Nothing
after the if statements ends when its highlighted then after highlightended is gone is shows mydataset = {System.Data.DataSet}

so does that mean anything to you

Yes and take out the .Tables("...").DefaultView from:
Expand|Select|Wrap|Line Numbers
  1. gridview1.DataSource = mydataset.Tables("OBCOP200").DefaultView
  2.  
I have a feeling you're looking up a table in your data set that doesn't exist...
Sep 11 '07 #12
the response write is for debugging but if I take that out nothing shows up

I thought that the Response.Write bit was for debugging purposes....
Am I wrong here???
Sep 11 '07 #13
Wel their are certain numbers that has alot of pages so I was going to do sorting and paging. Can a panel do that?

I thought that the Response.Write bit was for debugging purposes....
Am I wrong here???
Sep 11 '07 #14
Plater
7,872 Expert 4TB
From what I've read, Response.Write() just injects whatever you put into the current section of the buffer. Which could be inside one of your html elements.
I thought it was supposed to work similar to javascripts' Document.Write(), but I've ehard of it doing funny things with the sending buffer from people.

I thought that the Response.Write bit was for debugging purposes....
Am I wrong here???
Sep 11 '07 #15
Plater
7,872 Expert 4TB
Wel their are certain numbers that has alot of pages so I was going to do sorting and paging. Can a panel do that?
No no, gridview is the right object for displaying your data, it's the strings used in Response.Write() that should go into some temporary ASP:Label or other text-displaying control.
Sep 11 '07 #16
Frinavale
9,735 Expert Mod 8TB
the response write is for debugging but if I take that out nothing shows up
Well we know that you have filled your DataSet correctly...and that it's just a matter of getting that data to show in your GridView.

Take a look at MSDN's GridView.DataBind Method


The other thing I would try would be:
Expand|Select|Wrap|Line Numbers
  1.    1.
  2.       Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
  3.               Dim myconnection As OdbcConnection
  4.               Dim myCommand As OdbcDataAdapter
  5.               Dim mydataset As New DataSet
  6.               Dim gvResults As DataTable
  7.               Dim loop1 As Integer
  8.               Dim numrows As Integer
  9.               Dim mysql As String
  10.               Dim Order As Integer
  11.               Order = CInt(txtOrderNumber.Text)
  12.               mysql = "select  line#, ordno, quano, quana, quans, c2rdt, unitm, prdno, actsp  from rmsfiles2.obcop200 where ordno = " & Order
  13.               myconnection = New OdbcConnection("DRIVER=Client Access ODBC Driver (32-bit);UID=ODBC;PWD=XXXXXX;System=xxx.xxx.xxx.xxx")
  14.               myCommand = New OdbcDataAdapter(mysql, myconnection)     
  15.               myCommand.Fill(mydataset, "OBCOP200")
  16.  
  17.               gvResults = New DataTable
  18.               gvResults = mydataset.Tables(0)
  19.               numrows = gvResults.Rows.Count
  20.  
  21.               If numrows = 0 Then
  22.                   txtOrderNumber.Text = "Order#" & txtOrderNumber.Text & " invalid order number"
  23.  
  24.               Else
  25.                   txtOrderNumber.Text = ""
  26.            gridview1.DataSource = new Data.DataView(gvResults) 'mydataset.Tables("OBCOP200").DefaultView
  27.               gridview1.DataBind()
  28.               gridview1.Visible = True
  29.  
  30.            End If
When ever I'm dealing with GridViews I end up looking them up on MSDN...it's been a while since I've used them.
Sep 11 '07 #17
Frinavale
9,735 Expert Mod 8TB
From what I've read, Response.Write() just injects whatever you put into the current section of the buffer. Which could be inside one of your html elements.
I thought it was supposed to work similar to javascripts' Document.Write(), but I've ehard of it doing funny things with the sending buffer from people.

Response.Write does do funny things.
I sometimes use it when I'm lazy and just want to debug something quickly..but where the output ends up could end up before your html for the page.

You should use a label or something to write debugging stuff...just some of us are lazy ;)
Sep 11 '07 #18
Frinavale
9,735 Expert Mod 8TB
i did that and it still displays but not in gridview. It shows that I have three rows in the part where if numrows and on down . When I debug it it shows system. dataset where the fill command is and then it shows mydataset.Tables = {System.Data.DataTableCollection} at gvResults = (where the datatable is)
then it has the number of rows in if then and then it has the number that i typed inside the text box also in the else then it through the loop 23 times before displaying it. and then finally it shows at gridview1.DataSource = Nothing
after the if statements ends when its highlighted then after highlightended is gone is shows mydataset = {System.Data.DataSet}

so does that mean anything to you

When you are debugging...you will move from line to line....the line of code is not executed until you move to the next line in debugging.

That is why the DataSource is nothing when its highlighted...and then is set when it's moved to the next line.

Please remember that you are not setting the DataSource of the GridView in your loop....you set it afterwards....
Sep 11 '07 #19
when i do the debug it still says nothing in the gridview where it states gridview1.datasource = new data.dataview(gvResults)

Well we know that you have filled your DataSet correctly...and that it's just a matter of getting that data to show in your GridView.

Take a look at MSDN's GridView.DataBind Method


The other thing I would try would be:
Expand|Select|Wrap|Line Numbers
  1.    1.
  2.       Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
  3.               Dim myconnection As OdbcConnection
  4.               Dim myCommand As OdbcDataAdapter
  5.               Dim mydataset As New DataSet
  6.               Dim gvResults As DataTable
  7.               Dim loop1 As Integer
  8.               Dim numrows As Integer
  9.               Dim mysql As String
  10.               Dim Order As Integer
  11.               Order = CInt(txtOrderNumber.Text)
  12.               mysql = "select  line#, ordno, quano, quana, quans, c2rdt, unitm, prdno, actsp  from rmsfiles2.obcop200 where ordno = " & Order
  13.               myconnection = New OdbcConnection("DRIVER=Client Access ODBC Driver (32-bit);UID=ODBC;PWD=XXXXXX;System=xxx.xxx.xxx.xxx")
  14.               myCommand = New OdbcDataAdapter(mysql, myconnection)     
  15.               myCommand.Fill(mydataset, "OBCOP200")
  16.  
  17.               gvResults = New DataTable
  18.               gvResults = mydataset.Tables(0)
  19.               numrows = gvResults.Rows.Count
  20.  
  21.               If numrows = 0 Then
  22.                   txtOrderNumber.Text = "Order#" & txtOrderNumber.Text & " invalid order number"
  23.  
  24.               Else
  25.                   txtOrderNumber.Text = ""
  26.            gridview1.DataSource = new Data.DataView(gvResults) 'mydataset.Tables("OBCOP200").DefaultView
  27.               gridview1.DataBind()
  28.               gridview1.Visible = True
  29.  
  30.            End If
When ever I'm dealing with GridViews I end up looking them up on MSDN...it's been a while since I've used them.
Sep 11 '07 #20
Frinavale
9,735 Expert Mod 8TB
I suggest following the example from MSDN only instead of using the Microsoft SQL Database code, use your AS400 database code:
Expand|Select|Wrap|Line Numbers
  1.  Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
  2.  
  3.     ' This example uses Microsoft SQL Server and connects
  4.     ' to the Northwind sample database. The data source needs
  5.     ' to be bound to the GridView control only when the 
  6.     ' page is first loaded. Thereafter, the values are
  7.     ' stored in view state.                      
  8.     If Not IsPostBack Then
  9.  
  10.       ' Declare the query string.
  11.       Dim queryString As String = _
  12.         "Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]"
  13.  
  14.       ' Run the query and bind the resulting DataSet
  15.       ' to the GridView control.
  16.       Dim ds As DataSet = GetData(queryString)
  17.       If (ds.Tables.Count > 0) Then
  18.  
  19.         AuthorsGridView.DataSource = ds
  20.         AuthorsGridView.DataBind()
  21.  
  22.       Else
  23.  
  24.         Message.Text = "Unable to connect to the database."
  25.  
  26.       End If
  27.  
  28.     End If
  29.  
  30.   End Sub
  31.  
  32.   Function GetData(ByVal queryString As String) As DataSet
  33.  
  34.     ' Retrieve the connection string stored in the Web.config file.
  35.     Dim connectionString As String = ConfigurationManager.ConnectionStrings("NorthWindConnectionString").ConnectionString
  36.  
  37.     Dim ds As New DataSet()
  38.  
  39.     Try
  40.  
  41.       ' Connect to the database and run the query.
  42.       Dim connection As New SqlConnection(connectionString)
  43.       Dim adapter As New SqlDataAdapter(queryString, Connection)
  44.  
  45.       ' Fill the DataSet.
  46.       Adapter.Fill(ds)
  47.  
  48.  
  49.     Catch ex As Exception
  50.  
  51.       ' The connection failed. Display an error message.
  52.       Message.Text = "Unable to connect to the database."
  53.  
  54.     End Try
  55.  
  56.     Return ds
  57.  
  58.   End Function
  59.  
Sep 11 '07 #21
when i do the debug it still says nothing in the gridview where it states gridview1.datasource = new data.dataview(gvResults)
Sep 11 '07 #22
Do I need to make an app code then within a dataset with my data that I need because right now the getdata is underlined. Also How do I call the function into the submit button?
Sep 11 '07 #23
How do I call the function inside the button click and do I need to make app code with dataset in it
Sep 11 '07 #24
Frinavale
9,735 Expert Mod 8TB
Do I need to make an app code then within a dataset with my data that I need because right now the getdata is underlined.
No you don't...
The reason GetData is underlined is because you probably didn't create that function.

In the example the GetData gets the DataSet and returns it.
Did you create this Function?

You do not need to make another VB file to hold this code....if that's what you're asking.

Could you please post what your code looks like now?

Also How do I call the function into the submit button?
It's the same sort of thing...
In the Sub that handles the button click you create a data source for the GridView and then Bind the GridView to that data source.
Sep 11 '07 #25
page load code
Expand|Select|Wrap|Line Numbers
  1.  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  2.  
  3.         Dim Order As Integer
  4.         Order = CInt(txtOrderNumber.Text)
  5.  
  6.         If Not IsPostBack Then
  7.             Dim mysql As String = "select ordno, quano, quana, actsp from rmsfiles2.obcop200 where = " & Order
  8.  
  9.             Dim mydataset As DataSet = GetData(mysql)
  10.             If (mydataset > 0) Then
  11.                 gridview1.DataSource = mydataset
  12.                 gridview1.DataBind()
  13.             Else
  14.                 txtOrderNumber.Text = " unable to connect to the database"
  15.  
  16.             End If
  17.         End If
  18.  
button code
Expand|Select|Wrap|Line Numbers
  1. Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
  2.  
  3.         Dim connectionString = "DRIVER=Client Access ODBC Driver (32-bit);UID=ODBC;PWD=xxxxxxxxxx;System=XXX.XXX.XXX.XXX"
  4.  
  5.  
  6.         Dim myconnection As OdbcConnection
  7.         Dim myCommand As OdbcDataAdapter
  8.         Dim mydataset As New DataSet
  9.         ' Dim gvResults As DataTable
  10.         'Dim loop1 As Integer
  11.         ' Dim numrows As Integer
  12.         Dim sql As String
  13.         Dim Order As Integer
  14.         Order = CInt(txtOrderNumber.Text)
  15.         sql = "select  line#, ordno, quano, quana, quans, c2rdt, unitm, prdno, actsp  from rmsfiles2.obcop200 where ordno = " & Order
  16.         Try
  17.  
  18.             myconnection = New OdbcConnection("DRIVER=Client Access ODBC Driver (32-bit);UID=ODBC;PWD=xxxxxxxxxx;System=XXX.XXX.XXX.XXX")
  19.  
  20.             myCommand = New OdbcDataAdapter(sql, myconnection)
  21.  
  22.             myCommand.Fill(mydataset)
  23.         Catch ex As Exception
  24.             txtOrderNumber.Text = "invalid order number"
  25.  
  26.         End Try
  27.  
  28.         Return
  29.         gridview1.DataSource = mydataset
  30.         gridview1.DataBind()
  31.         gridview1.Visible = True
here is my function code:
Expand|Select|Wrap|Line Numbers
  1.  Function GetData(ByVal mysql As String) As DataSet
  2.         Dim connectionString = "DRIVER=Client Access ODBC Driver (32-bit);UID=ODBC;PWD=xxxxxxxxxx;System=XXX.XXX.XXX.XXX"
  3.  
  4.  
  5.         Dim myconnection As OdbcConnection
  6.         Dim myCommand As OdbcDataAdapter
  7.         Dim mydataset As New DataSet
  8.         ' Dim gvResults As DataTable
  9.         'Dim loop1 As Integer
  10.         ' Dim numrows As Integer
  11.         Dim sql As String
  12.         Dim Order As Integer
  13.         Order = CInt(txtOrderNumber.Text)
  14.         sql = "select  line#, ordno, quano, quana, quans, c2rdt, unitm, prdno, actsp  from rmsfiles2.obcop200 where ordno = " & Order
  15.         Try
  16.  
  17.             myconnection = New OdbcConnection("DRIVER=Client Access ODBC Driver (32-bit);UID=ODBC;PWD=xxxxxxxxxx;System=XXX.XXX.XXX.XXX")
  18.  
  19.             myCommand = New OdbcDataAdapter(sql, myconnection)
  20.  
  21.             myCommand.Fill(mydataset)
  22.         Catch ex As Exception
  23.             txtOrderNumber.Text = "invalid order number"
  24.  
  25.         End Try
  26.  
  27.         Return mydataset
  28.     End Function
  29.  
  30.  
No you don't...
The reason GetData is underlined is because you probably didn't create that function.

In the example the GetData gets the DataSet and returns it.
Did you create this Function?

You do not need to make another VB file to hold this code....if that's what you're asking.

Could you please post what your code looks like now?



It's the same sort of thing...
In the Sub that handles the button click you create a data source for the GridView and then Bind the GridView to that data source.
Sep 11 '07 #26
This part right here is underlined like its wrong
If (mydataset > 0) Then
No you don't...
The reason GetData is underlined is because you probably didn't create that function.

In the example the GetData gets the DataSet and returns it.
Did you create this Function?

You do not need to make another VB file to hold this code....if that's what you're asking.

Could you please post what your code looks like now?



It's the same sort of thing...
In the Sub that handles the button click you create a data source for the GridView and then Bind the GridView to that data source.
Sep 11 '07 #27
This part right here is underlined like its wrong
If (mydataset > 0) Then
yes that is wrong. .

you have to check the rows count to be > 0

it would be

If (mydataset.tables(0).rows.count > 0) then


hope this helps.

samir
Sep 11 '07 #28
Now its says under the function getData code is the order = cint(txtOrderNumber.text) is invalidcastexception was unhandled by user code and conversion from string to type integer is not valid

What should I do here?
Sep 12 '07 #29
Frinavale
9,735 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1.  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  2.  
  3.         Dim Order As Integer
  4.         Order = CInt(txtOrderNumber.Text)
  5.  
  6.         If Not IsPostBack Then
  7.             Dim mysql As String = "select ordno, quano, quana, actsp from rmsfiles2.obcop200 where = " & Order
  8.  
  9.             Dim mydataset As DataSet = GetData(mysql)
  10.             If (mydataset > 0) Then
  11.                 gridview1.DataSource = mydataset
  12.                 gridview1.DataBind()
  13.             Else
  14.                 txtOrderNumber.Text = " unable to connect to the database"
  15.  
  16.             End If
  17.         End If
  18.  
There is no need to grab the DataSet in the Page Load method because your user has probably not supplied an OrderNumber until they hit the button....

This is probably why you're getting that exception about casting...you're probably trying to cast an empty string into an integer.


The whole point to making the GetData function is so that you can get the DataSet from anywhere in code and not have to retype everything again.


Expand|Select|Wrap|Line Numbers
  1. Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
  2.  
  3.         Dim connectionString = "DRIVER=Client Access ODBC Driver (32-bit);UID=ODBC;PWD=xxxxxxxxxx;System=XXX.XXX.XXX.XXX"
  4.  
  5.  
  6.         Dim myconnection As OdbcConnection
  7.         Dim myCommand As OdbcDataAdapter
  8.         Dim mydataset As New DataSet
  9.         ' Dim gvResults As DataTable
  10.         'Dim loop1 As Integer
  11.         ' Dim numrows As Integer
  12.         Dim sql As String
  13.         Dim Order As Integer
  14.         Order = CInt(txtOrderNumber.Text)
  15.         sql = "select  line#, ordno, quano, quana, quans, c2rdt, unitm, prdno, actsp  from rmsfiles2.obcop200 where ordno = " & Order
  16.         Try
  17.  
  18.             myconnection = New OdbcConnection("DRIVER=Client Access ODBC Driver (32-bit);UID=ODBC;PWD=xxxxxxxxxx;System=XXX.XXX.XXX.XXX")
  19.  
  20.             myCommand = New OdbcDataAdapter(sql, myconnection)
  21.  
  22.             myCommand.Fill(mydataset)
  23.         Catch ex As Exception
  24.             txtOrderNumber.Text = "invalid order number"
  25.  
  26.         End Try
  27.  
  28.         Return
  29.         gridview1.DataSource = mydataset
  30.         gridview1.DataBind()
  31.         gridview1.Visible = True
Why do you have a Return on line 28 in this section of code?

I'm going to repeat myself here but...the whole point to the GetData Function is so that you don't have to retype the call to the database to get the DataSet.

I think you should change your GetData function to:

Function GetData(ByVal mysql As String, ByVal myOrderNumber As Integer)

This way you can check to make sure that the user entered an order number before trying to use it in the database call.

Expand|Select|Wrap|Line Numbers
  1.  Function GetData(ByVal mysql As String) As DataSet
  2.         Dim connectionString = "DRIVER=Client Access ODBC Driver (32-bit);UID=ODBC;PWD=xxxxxxxxxx;System=XXX.XXX.XXX.XXX"
  3.  
  4.  
  5.         Dim myconnection As OdbcConnection
  6.         Dim myCommand As OdbcDataAdapter
  7.         Dim mydataset As New DataSet
  8.         ' Dim gvResults As DataTable
  9.         'Dim loop1 As Integer
  10.         ' Dim numrows As Integer
  11.         Dim sql As String
  12.         Dim Order As Integer
  13.         Order = CInt(txtOrderNumber.Text)
  14.         sql = "select  line#, ordno, quano, quana, quans, c2rdt, unitm, prdno, actsp  from rmsfiles2.obcop200 where ordno = " & Order
  15.         Try
  16.  
  17.             myconnection = New OdbcConnection("DRIVER=Client Access ODBC Driver (32-bit);UID=ODBC;PWD=xxxxxxxxxx;System=XXX.XXX.XXX.XXX")
  18.  
  19.             myCommand = New OdbcDataAdapter(sql, myconnection)
  20.  
  21.             myCommand.Fill(mydataset)
  22.         Catch ex As Exception
  23.             txtOrderNumber.Text = "invalid order number"
  24.  
  25.         End Try
  26.  
  27.         Return mydataset
  28.     End Function
  29.  
  30.  
This is just a reminder: Please do not post the IP and Password to your database. This is sensitive information that should not be publicly shared. I have edited it out, but please don't post this information...this is for the safety of your own computer :)
Sep 12 '07 #30
It still doesn't display anything. Here is all my code is aspx.vb part
Expand|Select|Wrap|Line Numbers
  1. Imports System
  2. Imports System.Data
  3. Imports System.Data.SqlClient
  4. Imports System.Data.Odbc
  5. Imports System.Data.DataSet
  6. Imports System.Data.DataTableCollection
  7. Imports IBM.Data.DB2.iSeries
  8. Partial Class Parts_Inquiries_OrderDetailInquiry
  9.     Inherits System.Web.UI.Page
  10.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  11.  
  12.  
  13.         'Define variable to pass parm from calling page.
  14.         Dim OrderNumber As String
  15.         OrderNumber = Request.QueryString("ordno")
  16.  
  17.         'If part number passed in plug it into text box
  18.         If txtOrderNumber.Text = "" And OrderNumber > "" Then
  19.             txtOrderNumber.Text = OrderNumber
  20.         End If
  21.  
  22.         'Conditionally return to menu or previous page depending if parm passed in
  23.  
  24.         exitHyperLink.Text = " Prev"
  25.         exitHyperLink.NavigateUrl = "~/Parts/Inquiries/OrderInquiry.aspx" & txtOrderNumber.Text & ""
  26.  
  27.         TrackingHyperLink.Text = "Tracking"
  28.         TrackingHyperLink.NavigateUrl = "~/parts/inquiries/TrackingInquiry.aspx?ordno=" & txtOrderNumber.Text & ""
  29.  
  30.         exitHyperLink.Text = "Exit"
  31.         exitHyperLink.NavigateUrl = "~/parts/inquiries/EngineeringInquiryMenu.aspx"
  32.  
  33.  
  34.     End Sub
  35.  
  36.     Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
  37.  
  38.         Dim connectionString = "DRIVER=Client Access ODBC Driver (32-bit);UID=ODBC;PWD=xxxxxxxxxx;System=xxx.xxx.xxx.xxx"
  39.  
  40.  
  41.         Dim myconnection As OdbcConnection
  42.         Dim myCommand As OdbcDataAdapter
  43.         Dim mydataset As New DataSet
  44.          Dim sql As String
  45.         Dim Order As Integer
  46.         Order = CInt(txtOrderNumber.Text)
  47.         sql = "select  line#, ordno, quano, quana, quans, c2rdt, unitm, prdno, actsp  from rmsfiles2.obcop200 where ordno = " & Order
  48.         Try
  49.  
  50.             myconnection = New OdbcConnection("DRIVER=Client Access ODBC Driver (32-bit);UID=ODBC;PWD=xxxxxxxxx;System=xxx.xxx.xxx.xxx")
  51.  
  52.             myCommand = New OdbcDataAdapter(sql, myconnection)
  53.  
  54.             myCommand.Fill(mydataset)
  55.         Catch ex As Exception
  56.             txtOrderNumber.Text = "invalid order number"
  57.  
  58.         End Try
  59.  
  60.              gridview1.DataSource = mydataset
  61.         gridview1.DataBind()
  62.         gridview1.Visible = True
  63.  
  64.  
  65.  
  66.     End Sub
  67.  
  68.        Function GetData(ByVal mysql As String, ByVal myOrderNumber As Integer) As DataSet
  69.  
  70.         Dim connectionString = "DRIVER=Client Access ODBC Driver (32-bit);UID=ODBC;PWD=xxxxxxxxxxx;System=xxx.xxx.xxx.xxx"
  71.  
  72.  
  73.         Dim myconnection As OdbcConnection
  74.         Dim myCommand As OdbcDataAdapter
  75.         Dim mydataset As New DataSet
  76.  
  77.         Dim sql As String
  78.         Dim Order As Integer
  79.         Order = CInt(txtOrderNumber.Text)
  80.         sql = "select  line#, ordno, quano, quana, quans, c2rdt, unitm, prdno, actsp  from rmsfiles2.obcop200 where ordno = " & Order
  81.         Try
  82.  
  83.             myconnection = New OdbcConnection("DRIVER=Client Access ODBC Driver (32-bit);UID=ODBC;PWD=xxxxxx;System=xxx.xxx.xxx.xxx")
  84.  
  85.             myCommand = New OdbcDataAdapter(sql, myconnection)
  86.  
  87.             myCommand.Fill(mydataset)
  88.         Catch ex As Exception
  89.             txtOrderNumber.Text = "invalid order number"
  90.  
  91.         End Try
  92.  
  93.         Return mydataset
  94.     End Function
  95.  
  96.  
  97. End Class
  98.  
  99.  
Sep 12 '07 #31
Frinavale
9,735 Expert Mod 8TB
I've cleaned up your code so that its easier to follow.
Try this and tell me if it works...if it doesn't repost your exact code and we'll have another look.

Expand|Select|Wrap|Line Numbers
  1. Imports System
  2. Imports System.Data
  3. Imports System.Data.SqlClient
  4. Imports System.Data.Odbc
  5. Imports System.Data.DataSet
  6. Imports System.Data.DataTableCollection
  7. Imports IBM.Data.DB2.iSeries
  8. Partial Class Parts_Inquiries_OrderDetailInquiry
  9.     Inherits System.Web.UI.Page
  10.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  11.  
  12.  
  13.         'Define variable to pass parm from calling page.
  14.         Dim OrderNumber As String
  15.         OrderNumber = Request.QueryString("ordno")
  16.  
  17.         'If part number passed in plug it into text box
  18.         If txtOrderNumber.Text = "" And OrderNumber > "" Then
  19.             txtOrderNumber.Text = OrderNumber
  20.         End If
  21.  
  22.         'Conditionally return to menu or previous page depending if parm passed in
  23.  
  24.         exitHyperLink.Text = " Prev"
  25.         exitHyperLink.NavigateUrl = "~/Parts/Inquiries/OrderInquiry.aspx" & txtOrderNumber.Text & ""
  26.  
  27.         TrackingHyperLink.Text = "Tracking"
  28.         TrackingHyperLink.NavigateUrl = "~/parts/inquiries/TrackingInquiry.aspx?ordno=" & txtOrderNumber.Text & ""
  29.  
  30.         exitHyperLink.Text = "Exit"
  31.         exitHyperLink.NavigateUrl = "~/parts/inquiries/EngineeringInquiryMenu.aspx"
  32.  
  33.  
  34.     End Sub
  35.  
  36.     Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
  37.  
  38.         'Dim connectionString = "DRIVER=Client Access ODBC Driver (32-bit);UID=ODBC;PWD=xxxxxxxxxx;System=xxx.xxx.xxx.xxx"
  39.  
  40.  
  41.         'Dim myconnection As OdbcConnection
  42.        ' Dim myCommand As OdbcDataAdapter
  43.         'Dim mydataset As New DataSet
  44.          'Dim sql As String
  45.         Dim Order As Integer
  46. '        Order = CInt(txtOrderNumber.Text)
  47.  
  48. '********************New Code*************************
  49. 'The following makes sure that the value from the 
  50. 'txtOrderNumber is actually a number...it will handles the
  51. 'casting error
  52.          Try
  53.               Order = Integer.Parse(txtOrderNumber.Txt)
  54.          Catch e As Exception
  55.                Order = 0 
  56.                txtOrderNumber.Text= "Please Supply A Valid Number"
  57.           End Try
  58. '******************************************************
  59.  
  60.  
  61. 'The following has been commented out as it is done in your GetData Function
  62.  
  63.         'sql = "select  line#, ordno, quano, quana, quans, c2rdt, unitm, prdno, actsp  from rmsfiles2.obcop200 where ordno = " & Order
  64.         'Try
  65.  
  66.             'myconnection = New OdbcConnection("DRIVER=Client Access ODBC Driver (32-bit);UID=ODBC;PWD=xxxxxxxxx;System=xxx.xxx.xxx.xxx")
  67.  
  68.             'myCommand = New OdbcDataAdapter(sql, myconnection)
  69.  
  70.             'myCommand.Fill(mydataset)
  71.         'Catch ex As Exception
  72.             'txtOrderNumber.Text = "invalid order number"
  73.  
  74.        ' End Try
  75.  
  76. '********************New Code*************************
  77. Dim ds As DataSet = GetData(Order)
  78.       If (ds.Tables.Count > 0) Then
  79.         'gridview1.DataSource = mydataset
  80.         gridview1.DataSource = ds
  81.         gridview1.DataBind()
  82.         gridview1.Visible = True
  83.      Else
  84.          txtOrderNumber.Text="Unable to retrieve data"
  85.      End If
  86. '********************************************************
  87.  
  88.     End Sub
  89.  
  90.        'Function GetData(ByVal mysql As String, ByVal myOrderNumber As Integer) As DataSet
  91. 'Redefined how your GetData function works to better suit your specific problem.....
  92.  
  93. Function GetData(ByVal myOrderNumber As Integer) As DataSet
  94. 'Your Connection String should be stored in your web.config file.
  95. 'It should be stored in the <connectionStrings> section......
  96. 'We can get to that later if you would like
  97.         Dim connectionString = "DRIVER=Client Access ODBC Driver (32-bit);UID=ODBC;PWD=xxxxxxxxxxx;System=xxx.xxx.xxx.xxx"
  98.  
  99.  
  100.         Dim myconnection As OdbcConnection
  101.         Dim myCommand As OdbcDataAdapter
  102.         Dim mydataset As New DataSet
  103.  
  104.         Dim sql As String
  105.        'Order has been passed into this function and so this isn't needed
  106. '        Dim Order As Integer       
  107.         'Order = CInt(txtOrderNumber.Text)
  108.         'sql = "select  line#, ordno, quano, quana, quans, c2rdt, unitm, prdno, actsp  from rmsfiles2.obcop200 where ordno = " & Order
  109.         sql = "select  line#, ordno, quano, quana, quans, c2rdt, unitm, prdno, actsp  from rmsfiles2.obcop200 where ordno = " & Order.ToString()
  110. 'Please note the Order.ToString()....
  111.         Try
  112.  
  113.             myconnection = New OdbcConnection(connectionString )
  114.  
  115.             myCommand = New OdbcDataAdapter(sql, myconnection)
  116.  
  117.             myCommand.Fill(mydataset)
  118.         Catch ex As Exception
  119.             txtOrderNumber.Text = "Database Error: Unable to fill DataSet"
  120.  
  121.         End Try
  122.  
  123.         Return mydataset
  124.     End Function
  125.  
  126.  
  127. End Class
  128.  
  129.  
Sep 12 '07 #32
Frinavale
9,735 Expert Mod 8TB
Oh I see an error...you're not using the myOrderNumber parameter in your search......The code should be:

Expand|Select|Wrap|Line Numbers
  1.     Function GetData(ByVal myOrderNumber As Integer) As DataSet
  2.  
  3.         Dim connectionString = "DRIVER=Client Access ODBC Driver (32-bit);UID=ODBC;PWD=xxxxxxxx;System=xxx.xxx.xxx.xxx"
  4.  
  5.  
  6.         Dim myconnection As OdbcConnection
  7.         Dim myCommand As OdbcDataAdapter
  8.         Dim mydataset As New DataSet
  9.         Dim sql As String
  10.         'Dim Order As Integer
  11.         'Order = CInt(txtOrderNumber.Text)
  12. '*********Change the following Line*******************
  13.         'sql = "select  line#, ordno, quano, quana, quans, c2rdt, unitm, prdno, actsp  from rmsfiles2.obcop200 where ordno = " & Order.ToString()
  14.  
  15. '**********To this .........*****************
  16. sql = "select  line#, ordno, quano, quana, quans, c2rdt, unitm, prdno, actsp  from rmsfiles2.obcop200 where ordno = " & myOrderNumber .ToString()
  17.         Try
  18.  
  19.             myconnection = New OdbcConnection(connectionString) 
  20.             myCommand = New OdbcDataAdapter(sql, myconnection)
  21.             myCommand.Fill(mydataset)
  22.         Catch ex As Exception
  23.             txtOrderNumber.Text = "Database Error:Unable to fill Dataset"
  24.  
  25.         End Try
  26.  
  27.         Return mydataset
  28.     End Function
  29.  
Sep 12 '07 #33
Guess what it still don't work here is my code again

Expand|Select|Wrap|Line Numbers
  1.  
  2. Imports System
  3. Imports System.Data
  4. Imports System.Data.SqlClient
  5. Imports System.Data.Odbc
  6. Imports System.Data.DataSet
  7. Imports System.Data.DataTableCollection
  8. Imports IBM.Data.DB2.iSeries
  9. Partial Class Parts_Inquiries_OrderDetailInquiry
  10.     Inherits System.Web.UI.Page
  11.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  12.  
  13.  
  14.         'Define variable to pass parm from calling page.
  15.         Dim OrderNumber As String
  16.         OrderNumber = Request.QueryString("ordno")
  17.  
  18.         'If part number passed in plug it into text box
  19.         If txtOrderNumber.Text = "" And OrderNumber > "" Then
  20.             txtOrderNumber.Text = OrderNumber
  21.         End If
  22.  
  23.         'Conditionally return to menu or previous page depending if parm passed in
  24.  
  25.         exitHyperLink.Text = " Prev"
  26.         exitHyperLink.NavigateUrl = "~/Parts/Inquiries/OrderInquiry.aspx" & txtOrderNumber.Text & ""
  27.  
  28.         TrackingHyperLink.Text = "Tracking"
  29.         TrackingHyperLink.NavigateUrl = "~/parts/inquiries/TrackingInquiry.aspx?ordno=" & txtOrderNumber.Text & ""
  30.  
  31.         exitHyperLink.Text = "Exit"
  32.         exitHyperLink.NavigateUrl = "~/parts/inquiries/EngineeringInquiryMenu.aspx"
  33.  
  34.  
  35.     End Sub
  36.  
  37.     Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
  38.  
  39.         Dim Order As Integer
  40.  
  41.         Try
  42.             Order = Integer.Parse(txtOrderNumber.Text)
  43.  
  44.         Catch ex As Exception
  45.             Order = 0
  46.             txtOrderNumber.Text = "Please supply a valid number"
  47.             'End Catch
  48.  
  49.         End Try
  50.         Dim mydataset As DataSet = GetData(Order)
  51.         If (mydataset.Tables.Count > 0) Then
  52.             gridview1.DataSource = mydataset
  53.             gridview1.DataBind()
  54.             gridview1.Visible = True
  55.         Else
  56.             txtOrderNumber.Text = "Unable to retrieve data"
  57.         End If
  58.  
  59.  
  60.  
  61.     End Sub
  62.     Function GetData(ByVal myOrderNumber As Integer) As DataSet
  63.  
  64.         Dim connectionString = "DRIVER=Client Access ODBC Driver (32-bit);UID=ODBC;PWD=XXXXXX;System=XXX.XXX.XXX.XXX"
  65.  
  66.  
  67.         Dim myconnection As OdbcConnection
  68.         Dim myCommand As OdbcDataAdapter
  69.         Dim mydataset As New DataSet
  70.  
  71.         Dim sql As String
  72.         'Dim myOrderNumber As Integer
  73.  
  74.         sql = "select  line#, ordno, quano, quana, quans, c2rdt, unitm, prdno, actsp  from rmsfiles2.obcop200 where ordno = " & myOrderNumber.ToString()
  75.  
  76.         Try
  77.  
  78.             myconnection = New OdbcConnection(connectionString)             
  79.             myCommand = New OdbcDataAdapter(sql, myconnection)
  80.  
  81.             myCommand.Fill(mydataset)
  82.         Catch ex As Exception
  83.             txtOrderNumber.Text = "Database Error:Unable to fill Dataset"
  84.  
  85.         End Try
  86.  
  87.         Return mydataset
  88.     End Function
  89.  
  90. End Class
Sep 12 '07 #34
Frinavale
9,735 Expert Mod 8TB
Guess what it still don't work here is my code again
Are you getting any messages in your txtOrderNumber text box?

Could you please start using [ code] tags?

All you do is type: [ code=vbnet] then paste your code and then type [ /code]
(Please note that I left a space between the [ and the word "code" (or /code)..you have to remove the space to make the code tags work properly).

That'll save me from editing your posts :)
Also there is a comment in your code that contains your IP and Password still....you might want to fix this.

I'm going to look into reasons why this isn't working for you...get back to me about the messages :)

-Frinny
Sep 12 '07 #35
Frinavale
9,735 Expert Mod 8TB
I keep wondering if it has something to do with your DataSet.
Why don't we try using a DataView again?

I've used the following GetData function with my own GridView and it works fine...this should work for you too!

Expand|Select|Wrap|Line Numbers
  1. Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
  2.  
  3.         Dim Order As Integer
  4.  
  5.         Try
  6.             Order = Integer.Parse(txtOrderNumber.Text)
  7.  
  8.         Catch ex As Exception
  9.             Order = 0
  10.             txtOrderNumber.Text = "Please supply a valid number"
  11.             'End Catch
  12.  
  13.         End Try
  14. 'For now comment this out....
  15. '        Dim mydataset As DataSet = GetData(Order)
  16. '        If (mydataset.Tables.Count > 0) Then
  17. '           gridview1.DataSource = mydataset
  18.             gridview1.DataSource =GetData(Order)
  19.             gridview1.DataBind()
  20.             gridview1.Visible = True
  21. '        Else
  22. '            txtOrderNumber.Text = "Unable to retrieve data"
  23. '        End If
  24.     End Sub
  25.  
  26. '************Also comment out your current GetData Function and 
  27. '               Copy in the following code.....
  28. Function GetData(ByVal myOrderNumber As Integer) As Data.DataView
  29.         Dim dr As Data.DataRow
  30.         Dim dt As New Data.DataTable
  31.  
  32.             dt.Columns.Add(New Data.DataColumn("First Name", GetType(String)))
  33.             dt.Columns.Add(New Data.DataColumn("Last Name", GetType(String)))
  34.  
  35.             dr = dt.NewRow
  36.             dr("First Name") = "first row, first name"
  37.             dr("Last Name") = "first row, last name"
  38.  
  39.             dt.Rows.Add(dr)
  40.  
  41.             dr = dt.NewRow
  42.             dr("First Name") = "second row, first name"
  43.             dr("Last Name") = "second row, last name"
  44.  
  45.             dt.Rows.Add(dr)
  46.  
  47.         Dim dv As New Data.DataView(dt)
  48.         Return dv
  49.     End Function
  50.  
Sep 12 '07 #36
Ok thanks. The number that I typed in the textbox stays their after I hit the submit button. No messages or data is nowhere on that page.
Sep 12 '07 #37
Frinavale
9,735 Expert Mod 8TB
Ok thanks. The number that I typed in the textbox stays their after I hit the submit button. No messages or data is nowhere on that page.

Strange.
I would have expected it to have changed.
Using a Label to display error messages instead of your text box that you use for your input is a good idea :)

Did you try that code with the DataView yet?
Sep 12 '07 #38
So should I replace first name with ordno(factory order) and last name with quano(quantity)

Expand|Select|Wrap|Line Numbers
  1.  
  2. Function GetData(ByVal myOrderNumber As Integer) As Data.DataView
  3.         Dim dr As Data.DataRow
  4.         Dim dt As New Data.DataTable 
  5.  
  6.             dt.Columns.Add(New Data.DataColumn("First Name", GetType(String)))
  7.             dt.Columns.Add(New Data.DataColumn("Last Name", GetType(String)))
  8.  
  9.             dr = dt.NewRow
  10.             dr("First Name") = "first row, first name"
  11.             dr("Last Name") = "first row, last name"
  12.  
  13.             dt.Rows.Add(dr)
  14.  
  15.             dr = dt.NewRow
  16.             dr("First Name") = "second row, first name"
  17.             dr("Last Name") = "second row, last name"
  18.  
  19.             dt.Rows.Add(dr)
  20.  
  21.         Dim dv As New Data.DataView(dt)
  22.         Return dv
  23.     End Function
  24.  
Sep 12 '07 #39
Frinavale
9,735 Expert Mod 8TB
So should I replace first name with ordno(factory order) and last name with quano(quantity)

Expand|Select|Wrap|Line Numbers
  1.  
  2. Function GetData(ByVal myOrderNumber As Integer) As Data.DataView
  3.         Dim dr As Data.DataRow
  4.         Dim dt As New Data.DataTable 
  5.  
  6.             dt.Columns.Add(New Data.DataColumn("First Name", GetType(String)))
  7.             dt.Columns.Add(New Data.DataColumn("Last Name", GetType(String)))
  8.  
  9.             dr = dt.NewRow
  10.             dr("First Name") = "first row, first name"
  11.             dr("Last Name") = "first row, last name"
  12.  
  13.             dt.Rows.Add(dr)
  14.  
  15.             dr = dt.NewRow
  16.             dr("First Name") = "second row, first name"
  17.             dr("Last Name") = "second row, last name"
  18.  
  19.             dt.Rows.Add(dr)
  20.  
  21.         Dim dv As New Data.DataView(dt)
  22.         Return dv
  23.     End Function
  24.  
Just see if this works first...if you get something to appear then try entering other things :)
Sep 12 '07 #40
I don't get anything still no data
Sep 12 '07 #41
How would I use a label for error messages and where do I put the code at
Strange.
I would have expected it to have changed.
Using a Label to display error messages instead of your text box that you use for your input is a good idea :)

Did you try that code with the DataView yet?
Sep 12 '07 #42
Frinavale
9,735 Expert Mod 8TB
How would I use a label for error messages and where do I put the code at
In the Desgin View for your ASPX page:
  • Drag a Label object onto it
  • Click on the Label and in its properties set it's a name identifying it (eg: lbl_error)

Then when ever you want to display a message in the label, you set it the same way you do your TextBox...

Eg.
Expand|Select|Wrap|Line Numbers
  1. lbl_error.Text="this is my message"
  2.  
Just remember to clear the label every time a page request is made (in your page load set it's text to "") so that you aren't redisplaying old error messages.

Could you please post the ASP code for your GridView for me.
You will find this code in the Source View for you ASPX page...
(post it in [code =html] code tags).

I'm looking for something like the following:
Expand|Select|Wrap|Line Numbers
  1. <asp:GridView ID="myGridView" runat="server" CellPadding="4" ForeColor="#333333">
  2.     <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
  3.     <RowStyle BackColor="#F7F6F3" ForeColor="#333333" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
  4.     <EditRowStyle BackColor="#999999" />
  5.     <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
  6.     <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
  7.     <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
  8.     <AlternatingRowStyle BackColor="White" ForeColor="#284775" BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" />
  9.     <Columns>
  10.     </Columns>
  11. </asp:GridView>
Sep 12 '07 #43
I did this in page load lbl_error.Text = ""
and submit. Is this right lbl_error.Text = "Please supply a valid number"

This of course is in the aspx page
Expand|Select|Wrap|Line Numbers
  1.   <asp:GridView ID="gridview1" runat="server" CellPadding="3" ForeColor="Black" GridLines="Vertical" BackColor="White" BorderColor="#999999" BorderStyle="Solid" BorderWidth="1px"  Width="275px" AllowPaging="True" AutoGenerateColumns="False" AllowSorting="True" > 
  2.            <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
  3.             <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
  4.             <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
  5.             <AlternatingRowStyle BackColor="#CCCCCC" />
  6.         </asp:GridView>
  7. </asp:GridView>
Sep 12 '07 #44
Frinavale
9,735 Expert Mod 8TB
I did this in page load lbl_error.Text = ""
and submit. Is this right lbl_error.Text = "Please supply a valid number"

This of course is in the aspx page...
If you don't supply a number in the txtOrderNumber TextBox and you click the button, then yes you should be getting this message.

The reason you are getting this is because of this section of code:

Expand|Select|Wrap|Line Numbers
  1. Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
  2. '........
  3. '........
  4.        Try
  5.             Order = Integer.Parse(txtOrderNumber.Text)
  6.         Catch ex As Exception
  7.             Order = 0
  8.             'I'm assuming that your label is being used here now...
  9.             'txtOrderNumber.Text = "Please supply a valid number"
  10.  
  11.         End Try
  12. '........
  13. '........
  14.  
In this section of code, you are attempting to convert the value found in the txtOrderNumber TextBox into an Integer value. If there is a problem, then the value in the txtOrderNumber Text box was not a number and an exception is thrown. The exception is caught in the Catch portion and the "Please supply a number" message is displayed.
Sep 13 '07 #45
Frinavale
9,735 Expert Mod 8TB
How do I call the function inside the button click and do I need to make app code with dataset in it
I just realized that you do not know how to call a function!
I'm sorry I glanced over this question before.

First of all, a function returns something and a sub does not.

To call a sub or function (a method) from anywhere else in code you simply type its name.

For example say I have a sub called mySub:
Expand|Select|Wrap|Line Numbers
  1. Private Sub mySub()
  2.    'do something
  3. End Sub
  4.  
And say I want to call this sub from my button click Sub...all I would do is:
Expand|Select|Wrap|Line Numbers
  1. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  2.     mySub()
  3. End Sub
  4.  
If I were to call a Function on the other hand, I'd need to store it's output somewhere. So I need to create a variable in the button click Sub that matches the type that the Function returns and then call the Function...

For Example:
Expand|Select|Wrap|Line Numbers
  1.  
  2. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  3.     Dim myNumber As Integer = myFunction()
  4.     'myNumber will be set to 12 after the above line is executed.
  5.     'the number 12 is returned to this sub by the MyFunction function and is stored in the myNumber Integer.
  6. End Sub
  7.  
  8.  
  9. Private Function MyFunction() As Integer 'The "As Integer" portion of this line indicates what type of value is expected to be returned.
  10. 'This function returns an Integer value
  11.     Return 12
  12. End Function
  13.  
  14.  
One other thing about Subs and Functions is that you can pass values into them using parameters. Parameters are passed into Subs or Functions through the () part of the Sub or Function..

Private Function MyFunction(ByVal x As Integer) As Integer

(the bolded part is where the parameter is passed in)

A parameter is simply a variable passed into a Sub or Function that is used for some sort of processing within that function....

Expand|Select|Wrap|Line Numbers
  1. Private Function MyFunction((ByVal x As Integer) As Integer
  2.    'x is a parameter passed into this function.
  3.    'in this case an Integer is expected to be passed into this function
  4.    'x can then be used to do whatever with....
  5.  
  6.    'I'm going to subtract x from 12 and return that value
  7.     Return 12 - x
  8. End Function
  9.  
This is an example of calling a function that expects a paramter:
Expand|Select|Wrap|Line Numbers
  1. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  2.     Dim myNumber As Integer = MyFunction(3)
  3. 'In this case myNumber will be set to 9.....
  4. End Sub
  5.  
  6. Private Function MyFunction((ByVal x As Integer) As Integer
  7.    'x is a parameter passed into this function.
  8.    'in this case an Integer is expected to be passed into this function
  9.    'x can then be used to do whatever with....
  10.  
  11.    'I'm going to subtract x from 12 and return that value
  12.     Return 12 - x
  13. End Function
  14.  
Does this make sense?
Sep 13 '07 #46
Thats ok. I kind understand. How do I do mine though. As time goes by their will be alot of order numbers so I'm not for sure how to do it.
Here is all my code again.
rry I glanced over this question before.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Imports System
  3. Imports System.Data
  4. Imports System.Data.SqlClient
  5. Imports System.Data.Odbc
  6. Imports System.Data.DataSet
  7. Imports System.Data.DataTableCollection
  8. Imports IBM.Data.DB2.iSeries
  9. Partial Class Parts_Inquiries_OrderDetailInquiry
  10.     Inherits System.Web.UI.Page
  11.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  12.  
  13.  
  14.         'Define variable to pass parm from calling page.
  15.         Dim OrderNumber As String
  16.         OrderNumber = Request.QueryString("ordno")
  17.         lbl_error.Text = ""
  18.         'If part number passed in plug it into text box
  19.         If txtOrderNumber.Text = "" And OrderNumber > "" Then
  20.             txtOrderNumber.Text = OrderNumber
  21.         End If
  22.  
  23.         'Conditionally return to menu or previous page depending if parm passed in
  24.  
  25.         exitHyperLink.Text = " Prev"
  26.         exitHyperLink.NavigateUrl = "~/Parts/Inquiries/OrderInquiry.aspx" & txtOrderNumber.Text & ""
  27.  
  28.         TrackingHyperLink.Text = "Tracking"
  29.         TrackingHyperLink.NavigateUrl = "~/parts/inquiries/TrackingInquiry.aspx?ordno=" & txtOrderNumber.Text & ""
  30.  
  31.         exitHyperLink.Text = "Exit"
  32.         exitHyperLink.NavigateUrl = "~/parts/inquiries/EngineeringInquiryMenu.aspx"
  33.  
  34.  
  35.     End Sub
  36.  
Expand|Select|Wrap|Line Numbers
  1.     Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
  2.  
  3.         Dim Order As Integer
  4.  
  5.         Try
  6.             Order = Integer.Parse(txtOrderNumber.Text)
  7.  
  8.         Catch ex As Exception
  9.             Order = 0
  10.             lbl_error.Text = "Please supply a valid number"
  11.             'End Catch
  12.  
  13.         End Try
  14.         'Dim mydataset As DataSet = GetData(Order)
  15.         'If (mydataset.Tables.Count > 0) Then
  16.         gridview1.DataSource = GetData(Order)
  17.         gridview1.DataBind()
  18.         gridview1.Visible = True
  19.         ' Else
  20.         'txtOrderNumber.Text = "Unable to retrieve data"
  21.         'End If
  22.     End Sub
  23.  
Expand|Select|Wrap|Line Numbers
  1.     Function GetData(ByVal myOrderNumber As Integer) As Data.DataView
  2.         Dim dr As Data.DataRow
  3.         Dim dt As New Data.DataTable 'the table that will hold the card holders
  4.  
  5.         dt.Columns.Add(New Data.DataColumn("First Name", GetType(String)))
  6.         dt.Columns.Add(New Data.DataColumn("Last Name", GetType(String)))
  7.  
  8.         dr = dt.NewRow
  9.         dr("First Name") = "first row, first name"
  10.         dr("Last Name") = "first row, last name"
  11.  
  12.         dt.Rows.Add(dr)
  13.  
  14.         dr = dt.NewRow
  15.         dr("First Name") = "second row, first name"
  16.         dr("Last Name") = "second row, last name"
  17.  
  18.         dt.Rows.Add(dr)
  19.  
  20.         Dim dv As New Data.DataView(dt)
  21.         Return dv
  22.     End Function
  23.  
Sep 13 '07 #47
Also don't I have to have my connection string, data adapter, command and my sql statement somewhere in the code where it knows where to go ?
Sep 13 '07 #48
Frinavale
9,735 Expert Mod 8TB
Also don't I have to have my connection string, data adapter, command and my sql statement somewhere in the code where it knows where to go ?
Eventually you will have to connect to the database to retrieve the data from there and display it in the GridView.

Right now that is not working for you.
You don't seem to be able to have anything appear in your GridView ever....
I was suggesting going right down to a level that I know works and then work your way back up to connecting to the database and displaying the data.

I just wanted to see if your GridView was able to display Any data.
So I sent you a function that should have displayed 2 rows of data the GridView.

Are you saying that you didn't actually try this?
If you have tried it and the GridView showed nothing still...
I'd be concerned with the way your project is set up.
It sounds like the project itself is configured incorrectly and might be the cause to your GridView problem......

But I didn't want to suggest this until we tried something basic.
Like just displaying 2 hard coded rows in the GridView....this way I'd be able to tell if it was as database problem...or a problem with the project.


I'd strongly suggest trying this before we jump to any conclusions.
The following is what I think your code should look like while we are trying this out (this way we can easily start putting your database stuff back in):
Expand|Select|Wrap|Line Numbers
  1.  
  2. Imports System
  3. Imports System.Data
  4. Imports System.Data.SqlClient
  5. Imports System.Data.Odbc
  6. Imports System.Data.DataSet
  7. Imports System.Data.DataTableCollection
  8. Imports IBM.Data.DB2.iSeries
  9. Partial Class Parts_Inquiries_OrderDetailInquiry
  10.     Inherits System.Web.UI.Page
  11.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  12.  
  13.  
  14.         'Define variable to pass parm from calling page.
  15.         Dim OrderNumber As String
  16.         OrderNumber = Request.QueryString("ordno")
  17.         lbl_error.Text = ""
  18.         'If part number passed in plug it into text box
  19.         If txtOrderNumber.Text = "" And OrderNumber > "" Then
  20.             txtOrderNumber.Text = OrderNumber
  21.         End If
  22.  
  23.         'Conditionally return to menu or previous page depending if parm passed in
  24.  
  25.         exitHyperLink.Text = " Prev"
  26.         exitHyperLink.NavigateUrl = "~/Parts/Inquiries/OrderInquiry.aspx" & txtOrderNumber.Text & ""
  27.  
  28.         TrackingHyperLink.Text = "Tracking"
  29.         TrackingHyperLink.NavigateUrl = "~/parts/inquiries/TrackingInquiry.aspx?ordno=" & txtOrderNumber.Text & ""
  30.  
  31.         exitHyperLink.Text = "Exit"
  32.         exitHyperLink.NavigateUrl = "~/parts/inquiries/EngineeringInquiryMenu.aspx"
  33.  
  34.  
  35.     End Sub
  36.  
  37.  
  38.     Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
  39.  
  40.         Dim Order As Integer
  41.  
  42.         Try
  43.             Order = Integer.Parse(txtOrderNumber.Text)
  44.  
  45.         Catch ex As Exception
  46.             Order = 0
  47.             lbl_error.Text = "Please supply a valid number"
  48.             'End Catch
  49.  
  50.         End Try
  51.         'Dim mydataset As DataSet = GetData(Order)
  52.         'If (mydataset.Tables.Count > 0) Then
  53.         gridview1.DataSource = GetData(Order)
  54.         gridview1.DataBind()
  55.         gridview1.Visible = True
  56.         ' Else
  57.         'txtOrderNumber.Text = "Unable to retrieve data"
  58.         'End If
  59.     End Sub  
  60.     Function GetData(ByVal myOrderNumber As Integer) As Data.DataView
  61.         Dim dr As Data.DataRow
  62.         Dim dt As New Data.DataTable 'the table that will hold the card holders
  63.  
  64.         dt.Columns.Add(New Data.DataColumn("First Name", GetType(String)))
  65.         dt.Columns.Add(New Data.DataColumn("Last Name", GetType(String)))
  66.  
  67.         dr = dt.NewRow
  68.         dr("First Name") = "first row, first name"
  69.         dr("Last Name") = "first row, last name"
  70.  
  71.         dt.Rows.Add(dr)
  72.  
  73.         dr = dt.NewRow
  74.         dr("First Name") = "second row, first name"
  75.         dr("Last Name") = "second row, last name"
  76.  
  77.         dt.Rows.Add(dr)
  78.  
  79.         Dim dv As New Data.DataView(dt)
  80.         Return dv
  81.     End Function
  82.  'Function GetData(ByVal myOrderNumber As Integer) As DataSet
  83.  
  84. '    Dim connectionString = "DRIVER=Client Access ODBC Driver (32-bit);UID=ODBC;PWD=XXXXXX;System=XXX.XXX.XXX.XXX"
  85.  
  86.  
  87. '    Dim myconnection As OdbcConnection
  88. '    Dim myCommand As OdbcDataAdapter
  89. '    Dim mydataset As New DataSet
  90.  
  91. '    Dim sql As String
  92. '    'Dim myOrderNumber As Integer
  93.  
  94. '    sql = "select  line#, ordno, quano, quana, quans, c2rdt, unitm, prdno, actsp  from rmsfiles2.obcop200 where ordno = " & myOrderNumber.ToString()
  95.  
  96. '    Try
  97.  
  98. '        myconnection = New OdbcConnection(connectionString)
  99. '        myCommand = New OdbcDataAdapter(sql, myconnection)
  100.  
  101. '        myCommand.Fill(mydataset)
  102. '    Catch ex As Exception
  103. '        txtOrderNumber.Text = "Database Error:Unable to fill Dataset"
  104.  
  105. '    End Try
  106.  
  107. '    Return mydataset
  108. 'End Function
  109.  
  110. End Class
  111.  
Try this if you haven't already....
Get back to me with the results.

-Frinny
Sep 13 '07 #49
Ok I try it. Nothing comes up when I do a number however when I type in name it comes up with please supply a valid number. What should we do
Sep 13 '07 #50

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
0
by: Adam Sandler | last post by:
Hello, Prior to posting I looked at http://groups.google.com/group/ microsoft.public.dotnet.framework.aspnet/browse_thread/thread/ d8d5ae243614085e/d4fd6c4a5aa56f75 ...
1
by: MikeB | last post by:
ooh boy, I hope I'm in the right place to ask this. I'm trying to do a class project that binds controls to data sources. I have a Drop-down List that I bound to the Author column of an SQL...
2
by: Steve Kershaw | last post by:
Hi, I'm working on a project in which I have a Gridview that has data. That Gridview data must be then exported to an Excel spreadsheet. I have successfully displayed the Excel spreadsheet and...
6
by: marylipscomb | last post by:
I am using VB.NET. I am trying to connect a button so that when it is clicked the gridview pops up the data. Partial Class Switchboard Inherits System.Web.UI.Page Protected Sub...
2
by: mathewgk80 | last post by:
Hi all, I would like to know how can i view a grid in page load.... I dont bind any data into tht gridview.. But i want to show the grid header and footer in the page.. I am using asp.net...
2
by: =?Utf-8?B?VmFpYmhhdg==?= | last post by:
I am trying to populate dataset from gridview but it's not working . Can anyone plz tell me how to do it..
2
by: satwinder singh | last post by:
Please help me regarding how to Export the Data from DataSet or GridView into Excel sheet. Kind Regards, Satwinder singh
5
by: satyabhaskar | last post by:
hi, I want to bind the data from the Dataset to GridView When I run my code I get the error The type or namespace name 'DataRows' could not be found (are you missing...
1
by: Vidya A | last post by:
How to bind dataset to gridview in asop.net with vb using code
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.