Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server ASP
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Server ASP Discussions about ASP programming with Microsoft's SQL Server. For more ASP forums, see the ASP forum category.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server ASP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old January 30th, 2005, 04:48 PM
h3x h3x is offline
Registered User
Join Date: Jan 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Cast from string "" to type 'Integer' is not valid

hi there i just started .NET (ASP n VB) this semester n i created this webpage which brings back data from the database ... whn i enter the search parameter it gives me this error .. "Cast from string "" to type 'Integer' is not valid."
heres my code ...plz help me out ...


Private Sub btnSearchInvt_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSearchInvt.Click

            Dim InventoryInformation As DataSet = Lab1.OrderSystem.LookUpInventoryByStockNumber(txtE mpID2.Text, StockNum.Text)
            If InventoryInformation.Tables("InventoryInformation" ).Rows.Count > 0 Then
                With InventoryInformation.Tables("InventoryInformation" ).Rows(0)
                    StockNum.Text = .Item("StockNumber")
                    InventoryNumber.Text = .Item("InventoryNumber")
                    Description.Text = .Item("Description")
                    Price.Text = .Item("Price")
                    ReOrderLevel.Text = .Item("ReOrderLevel")
                    UnitCost.Text = .Item("UnitCost")
                    OrderUnitSize.Text = .Item("OrderUnitSize")
                    OrderUnitType.Text = .Item("OrderUnitType")
                    Discontinued.Text = .Item("Discontinued")
                    QuantityOnHand.Text = .Item("QuantityOnHand")
                End With
                lblErrStock.Text = txtEmpID2.Text & " was not found "
            End If
        Catch ex As Exception
            lblErrStock.Text = ex.Message
        End Try
    End Sub

Public Class Inventory
    Public Shared Function LookInventoryByStockNumber(ByVal EmployeeID As Integer, ByVal StockNum As Integer) As DataSet
        Dim eVideo As SqlConnection = New SqlConnection(eVideoConnectionString)
        Dim adapter As SqlDataAdapter = New SqlDataAdapter("exec LookUpInventoryByStockNumber @EmployeeID, @StockNum", eVideo)
        adapter.SelectCommand.Parameters.Add("@EmployeeID" , SqlDbType.Int).Value = EmployeeID
        Dim InventoryInformation As DataSet = New DataSet
        adapter.Fill(InventoryInformation, "InventoryInformation")
        Return InventoryInformation
    End Function
End Class

Reply With Quote
  #2 (permalink)  
Old January 30th, 2005, 09:35 PM
Friend of Wrox
Join Date: Nov 2003
Location: Lehigh Acres, FL, USA.
Posts: 625
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jemacc

Check your data types and make your they are consistent in your statements.

Jaime E. Maccou
Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cast from string to type Double not valid mika27 ASP.NET 2.0 Basics 0 January 31st, 2007 05:52 AM
Err: Cast from String "" to type byte is not valid Parbish BOOK: Beginning VB.NET Databases 1 July 9th, 2005 06:43 PM
Cast from string "" to type 'Double' is not dounme SQL Server 2000 1 February 18th, 2005 01:44 AM

All times are GMT -4. The time now is 03:37 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.