Click here to Skip to main content
15,908,776 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Crystal Reports??? Pin
sybux20009-Apr-04 5:42
sybux20009-Apr-04 5:42 
AnswerRe: Crystal Reports??? Pin
hounetdev9-Apr-04 6:15
hounetdev9-Apr-04 6:15 
GeneralAddin an icon to files created by a VB.NET Application Pin
nvmoss9-Apr-04 5:22
nvmoss9-Apr-04 5:22 
GeneralRe: Addin an icon to files created by a VB.NET Application Pin
sybux20009-Apr-04 5:39
sybux20009-Apr-04 5:39 
GeneralVB and DataGrid Pin
sybux20009-Apr-04 4:50
sybux20009-Apr-04 4:50 
Generalvb.net API to fetch/retrieve email Pin
asimeerza8-Apr-04 22:05
asimeerza8-Apr-04 22:05 
GeneralRe: vb.net API to fetch/retrieve email Pin
asimeerza9-Apr-04 2:54
asimeerza9-Apr-04 2:54 
Generalupdate sql db using vb.net Pin
partt8-Apr-04 9:33
partt8-Apr-04 9:33 
I'm trying to update some tables in an sql db when the Update button is clicked and got the following error:

Column 'TesterID' does not belong to table Table.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Column 'TesterID' does not belong to table Table.

Source Error:
Line 530: Return r("TesterID")

Source File: C:\Documents and Settings\partt\My Documents\Visual Studio Projects\NewRecruit\Consumer.vb Line: 530

Stack Trace:
[ArgumentException: Column 'TesterID' does not belong to table Table.]
System.Data.DataRow.get_Item(String columnName) +119
NewRecruit.PK.BusinessLogicLayer.Consumer.InsertTesterStuff() in C:\Documents and Settings\partt\My Documents\Visual Studio Projects\NewRecruit\Consumer.vb:530
NewRecruit.PK.BusinessLogicLayer.Consumer.PKTesterUpdate() in C:\Documents and Settings\partt\My Documents\Visual Studio Projects\NewRecruit\Consumer.vb:518
NewRecruit.Tester.btnUpdate_Click(Object sender, EventArgs e) in C:\Documents and Settings\partt\My Documents\Visual Studio Projects\NewRecruit\Tester.aspx.vb:513
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1263

Here is the code:
(stored procedure)
CREATE PROCEDURE usp_tp_UpdatePKTester
@TesterID char(7),
@LastName varchar(50),
@FirstName varchar(50),
@Address varchar(50),
@City varchar(50)
AS

IF EXISTS (SELECT TesterID FROM tTester WHERE TesterID = @TesterID)
BEGIN
UPDATE tTester
SET LastName= @LastName,
FirstName = @FirstName,
Address = @Address,
City = @City

WHERE (TesterID = @TesterID)
IF (@@ERROR <> 0) GOTO ErrorHandler
SELECT
1 AS RtnVal
END
ELSE
SELECT
-2 AS RtnVal

IF @@ERROR <> 0
GOTO ErrorHandler
ELSE
BEGIN
-- COMMIT
RETURN(0)
END
ErrorHandler:
BEGIN
-- ROLLBACK
RETURN(1)
END
GO

("Consumer" Class):
'call insert for tester
Public Function PKTesterUpdate() As Integer
Return InsertTesterStuff()
End Function
'Insert the Tester data
Private Function InsertTesterStuff() As Integer
Dim ds As DataSet = SqlHelper.ExecuteDataset(ConfigurationSettings.AppSettings(Web.Global.CfgKeyConnString), _
"usp_tp_UpdatePKTester", _
_TesterID, _
_LastName, _
_FirstName, _
_Address, _
_City)
Dim r As DataRow = ds.Tables(0).Rows(0)
Return r("TesterID")
End Function

("Tester" Web form):
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
Dim PKTUpdate As DataTable = DirectCast(Session("GetPKTUpdate"), DataTable)
If PKTUpdate Is Nothing Then
PKTUpdate = New DataTable()
End If
Dim tu As New PK.BusinessLogicLayer.Consumer()
tu.TesterID = Request.QueryString("TesterID")

tu.TesterID = txtID.Text
tu.LastName = txtLName.Text
tu.FirstName = txtFName.Text
tu.Address = txtAddress.Text
tu.City = txtCity.Text

tu.PKTesterUpdate()
Session("GetPKTUpdate") = PKTUpdate
End Sub

Any help is much appreciated
Thank you,
jdSigh | :sigh:
GeneralRe: update sql db using vb.net Pin
Dave Kreskowiak8-Apr-04 11:21
mveDave Kreskowiak8-Apr-04 11:21 
GeneralRe: update sql db using vb.net Pin
Anonymous9-Apr-04 3:36
Anonymous9-Apr-04 3:36 
GeneralDrag and Drop from .net to Another application like AUTOCAD Pin
Member 9169658-Apr-04 7:56
Member 9169658-Apr-04 7:56 
GeneralRe: Drag and Drop from .net to Another application like AUTOCAD Pin
Heath Stewart8-Apr-04 8:25
protectorHeath Stewart8-Apr-04 8:25 
GeneralRe: Drag and Drop from .net to Another application like AUTOCAD Pin
Member 9169658-Apr-04 8:31
Member 9169658-Apr-04 8:31 
GeneralRe: Drag and Drop from .net to Another application like AUTOCAD Pin
Heath Stewart8-Apr-04 8:38
protectorHeath Stewart8-Apr-04 8:38 
GeneralRe: Drag and Drop from .net to Another application like AUTOCAD Pin
Member 9169658-Apr-04 8:52
Member 9169658-Apr-04 8:52 
GeneralRe: Drag and Drop from .net to Another application like AUTOCAD Pin
Heath Stewart8-Apr-04 9:09
protectorHeath Stewart8-Apr-04 9:09 
GeneralRe: Drag and Drop from .net to Another application like AUTOCAD Pin
Hemant Athavale9-Apr-04 18:59
sussHemant Athavale9-Apr-04 18:59 
GeneralServer.MapPath() Returns broken Image links Pin
Anonymous8-Apr-04 6:52
Anonymous8-Apr-04 6:52 
QuestionReports?? Pin
hounetdev8-Apr-04 6:29
hounetdev8-Apr-04 6:29 
AnswerRe: Reports?? Pin
Sarvesvara (BVKS) Dasa9-Apr-04 18:45
Sarvesvara (BVKS) Dasa9-Apr-04 18:45 
QuestionHow to Kill multiple processes? Pin
ndalal8-Apr-04 6:02
ndalal8-Apr-04 6:02 
GeneralHooking password textbox Pin
a4hd8-Apr-04 5:20
a4hd8-Apr-04 5:20 
GeneralRe: Hooking password textbox Pin
Colin Angus Mackay8-Apr-04 5:54
Colin Angus Mackay8-Apr-04 5:54 
GeneralRe: Hooking password textbox Pin
Heath Stewart8-Apr-04 8:42
protectorHeath Stewart8-Apr-04 8:42 
GeneralFile associations &amp; File Types Editor Pin
nvmoss8-Apr-04 4:59
nvmoss8-Apr-04 4:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.