CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2010
    Posts
    5

    Unhappy Newbie coder needs help with code

    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
    *****************************************************************

    Code:
            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 :

    Code:
    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?
    Last edited by HanneSThEGreaT; April 22nd, 2010 at 02:53 AM.

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Newbie coder needs help with code

    Please go back and edit your code to use Code Tags
    Code:
    ' like this
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,284

    Re: Newbie coder needs help with code

    Please use code tags, as explained here :

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

  4. #4
    Join Date
    Apr 2010
    Posts
    5

    Re: Newbie coder needs help with code

    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 :

    Code:
     <%@ 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

  5. #5
    Join Date
    Dec 2007
    Posts
    234

    Re: Newbie coder needs help with code

    what does the code for your submit button look like (not the VB code, but the asp side of it.)

    -tg

  6. #6
    Join Date
    Apr 2010
    Posts
    5

    Re: Newbie coder needs help with code

    Thank you Tech, i forgot to add the onclick attribute :

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured