Wrox Programmer Forums
|
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 6th, 2011, 03:52 AM
Registered User
 
Join Date: Jun 2011
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Post asp.net vb

Hi wrox,
i've been trying to save data into sql server database with this code
on saving, it gives me no error but it doesnt save in the database too
kindly help me

Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim connection As SqlConnection = Nothing

Dim conn As String = ConfigurationManager.ConnectionStrings("CrimeManag ementConnectionString").ConnectionString
connection = New SqlConnection(conn)

connection.Open()
Dim sql As String = "INSERT INTO Case(ComplainantName,ContactNumber) VALUES(@ComplainantName, @ContactNumber)"
Dim cmd As SqlCommand = New SqlCommand(sql, connection)
cmd.Parameters.AddWithValue("@ComplainantName", txtCmplntName.Text.Trim())
cmd.Parameters.AddWithValue("@ContactNumber", txtCmplntContact.Text.Trim())
connection.Close()

Response.Redirect("ComplainMain.aspx")

End Sub





Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET 1.1,VB.NET,crystal reports, SQl server gvi Crystal Reports 1 September 11th, 2008 02:55 AM
send MASS Emails in ASP.NET 2 with VB.NET 2005 alexdcosta ASP.NET 2.0 Basics 1 July 17th, 2006 12:31 AM
Parse XML doc using VB.NET into ASP.NET page kwilliams Classic ASP XML 17 November 11th, 2005 10:42 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.