Click to See Complete Forum and Search --> : Newbie coder needs help with code


Senzaki
April 21st, 2010, 02:35 PM
Hi there fellow forumers.

I need your help with a small and simple interface im creating similar to an order form.

Its written in ASP.NET and VB.

I have 3 main files im coding from : webserice.asmx, webservice.vb and default.aspx

I only have one webservice at the moment, it is primitive and simple and here is what it looks like :

i left out the var declarations and headers
*****************************************************************

conn.Open()
cmd = conn.CreateCommand()
cmd.CommandText = "INSERT INTO cdReq ([serial], [branch], [client], [status], [email], [address], [reason], [betaal], [bankBes], [reqDate], [regDate]) VALUES('" + serial.ToString + "', '" + branch + "', '" + client + "', '" + status + "', '" + email + "', '" + address + "', '" + reason + "', '" + betaal + "', '" + bankBes + "', '" + reqDate + "', '" + regDate + "')"
cmd.ExecuteNonQuery()
conn.Close()


When i run JUST that service i can update the database sucessfully(using debugging mode)

but when i try to update the database from my own interface(webservices.vb) it wont update it at all, and i really dont know where to look for my problem(all 3 files compile)

Here is the code for the Webservices.vb file :

Option Strict On
Imports System
Imports System.Collections
Imports System.Data
Imports System.Data.OleDb
Imports Microsoft.VisualBasic
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls

Public Class Cdform : Inherits Page

Protected txtSerial As TextBox
Protected txtEmail As TextBox
Protected txtRegDate As TextBox
Protected txtReqDate As TextBox
Protected txtBranch As TextBox
Protected txtClient As TextBox
Protected txtAddress As TextBox
Protected txtReason As TextBox
Protected txtStatus As TextBox
Protected txtBank As TextBox
Protected txtPay As TextBox
Protected cmdSubmit As Button
'====================================

Public Sub cmdSubmit_click(ByVal sender As Object, ByVal e As EventArgs)

Dim myService As New Service1
myService.addCD(txtSerial.text, txtBranch.text, txtClient.text, txtStatus.txt, txtEmail.text, txtAddress.text, txtReason.text, txtPay.text, txtBank.text, txtReqDate.text, txtRegDate.text)
End Sub

End Class

'=========================================

As far as i know i called the procedure correctly, giving all the var to the "Add cd" proc but it just wont update.


Any help please?

dglienna
April 22nd, 2010, 02:11 AM
Please go back and edit your code to use Code Tags

' like this

HanneSThEGreaT
April 22nd, 2010, 02:53 AM
Please use code tags, as explained here :

http://www.codeguru.com/forum/showthread.php?t=403073

Senzaki
April 22nd, 2010, 10:43 AM
Hey there, i will from now on make sure to put my code in the tags.

What i found whas that it isnt the code withing my codebehind file that isnt working, its the fact that my Default.aspx is not detecting my codebehind file, even though i referenced it at the start of my page on default.aspx :

<%@ Page Title="Home Page" Language="VB" codebehind="WebService.vb" %>

What else could i add, or what else could i test to see why my main Default.aspx file isnt reading and using the code from my Codebehind file "Webservice.vb

TechGnome
April 22nd, 2010, 10:58 AM
what does the code for your submit button look like (not the VB code, but the asp side of it.)

-tg

Senzaki
April 29th, 2010, 01:34 AM
Thank you Tech, i forgot to add the onclick attribute :

<asp:Button ID="cmdSubmit" onclick="cmdSubmit_click" runat="server"
Text="Submit"/>