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
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
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 30th, 2005, 03: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 ...

LookUpInventoryByStockNumber.aspx.vb

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

        Try
            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
            Else
                lblErrStock.Text = txtEmpID2.Text & " was not found "
            End If
        Catch ex As Exception
            lblErrStock.Text = ex.Message
        End Try
    End Sub

Inventory.vb
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, 08: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
Default

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

Jaime E. Maccou
Reply With Quote
Reply


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 04:52 AM
Err: Cast from String "" to type byte is not valid Parbish BOOK: Beginning VB.NET Databases 1 July 9th, 2005 05:43 PM
Cast from string "" to type 'Double' is not dounme SQL Server 2000 1 February 18th, 2005 12:44 AM



All times are GMT -4. The time now is 01:05 AM.


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