Click here to Skip to main content
15,905,914 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionUpgrading from vb 6.0 to .net 2005 Pin
ShuklaGirish18-Jun-07 20:18
ShuklaGirish18-Jun-07 20:18 
AnswerRe: Upgrading from vb 6.0 to .net 2005 Pin
Christian Graus18-Jun-07 20:21
protectorChristian Graus18-Jun-07 20:21 
AnswerRe: Upgrading from vb 6.0 to .net 2005 Pin
Sathesh Sakthivel18-Jun-07 20:24
Sathesh Sakthivel18-Jun-07 20:24 
Questionraising an event for a particular dropdownlist when multiple dropdownlists are being added to a webform dynamically. Pin
honeyss18-Jun-07 20:13
honeyss18-Jun-07 20:13 
AnswerRe: raising an event for a particular dropdownlist when multiple dropdownlists are being added to a webform dynamically. Pin
Christian Graus18-Jun-07 20:30
protectorChristian Graus18-Jun-07 20:30 
GeneralRe: raising an event for a particular dropdownlist when multiple dropdownlists are being added to a webform dynamically. Pin
honeyss18-Jun-07 20:46
honeyss18-Jun-07 20:46 
GeneralRe: raising an event for a particular dropdownlist when multiple dropdownlists are being added to a webform dynamically. Pin
Christian Graus18-Jun-07 21:09
protectorChristian Graus18-Jun-07 21:09 
Questionasp.net n access database Pin
ling_luv18-Jun-07 20:11
ling_luv18-Jun-07 20:11 
hi, i did psot jus now now i have done the selection into the listbox. now i need to add the record in the listbox into the actor table in access database. i have done for the movice which are all textbox. i have try the same code for lsitbox but the problem is the INSERT INTO statment gt error. Please advice. thanks a lot. below is my code.


VB CODE

Partial Public Class _Default
Inherits System.Web.UI.Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load


End Sub


Protected Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
Dim Moviename
Dim Actorname
Dim Director
Dim Language
Dim Numberofdisc
Dim Studio
Dim ReleaseDate
Dim Price
Dim Quantity
Dim sql
Dim asql


Dim DBconn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("dvd_rental.mdb"))

DBconn.Open()


Moviename = txtmovieName.Text
Language = txtlanguage.Text
Numberofdisc = txtNoofDisc.Text
Studio = txtStudio.Text
ReleaseDate = txtReleaseDate.Text
Price = txtPrice.Text
Quantity = txtQuantity.Text



sql = "INSERT INTO Movie(MovieName, MovieLanguage, Numberofdisc, Studio, ReleaseDate, Price, Quantity) "

sql = sql & "VALUES('" & Moviename & "'"
sql = sql & ",'" & Language & "'"
sql = sql & ",'" & Numberofdisc & "'"
sql = sql & ",'" & Studio & "'"
sql = sql & ",'" & ReleaseDate & "'"
sql = sql & ",'" & Price & "'"
sql = sql & ",'" & Quantity & "')"


Dim dbquery As New OleDb.OleDbCommand
dbquery.CommandType = CommandType.Text
dbquery.CommandText = sql
dbquery.Connection = DBconn
dbquery.ExecuteNonQuery()

DBconn.Close()
DBconn = Nothing

Actorname = lstbxActor.Text
Director = lstbxDirector.Text

Dim DBAconn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & Server.MapPath("dvd_rental.mdb"))

DBAconn.Open()

asql = "INSERT INTO Actor(Actor Name)"

asql = asql & "VALUES('" & Actorname & "')"

Dim dbAquery As New OleDb.OleDbCommand
dbAquery.CommandType = CommandType.Text
dbAquery.CommandText = asql
dbAquery.Connection = DBAconn
dbAquery.ExecuteNonQuery()


DBAconn.Close()
DBAconn = Nothing

End Sub

Protected Sub txtActorname_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtActorname.TextChanged

End Sub
Protected Sub lstbxActor_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstbxActor.SelectedIndexChanged

End Sub


Protected Sub btnAddActor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddActor.Click
If DropDownList1.SelectedValue <> "Others" Then

lstbxActor.Items.Add(DropDownList1.SelectedValue)

ElseIf DropDownList1.SelectedValue = "Others" Then
txtActorname.Focus()
End If



End Sub

Protected Sub btnAddNewActor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddNewActor.Click
lstbxActor.Items.Add(txtActorname.Text)
End Sub

Protected Sub btnAddDirector_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddDirector.Click
If DropDownList2.SelectedValue <> "Others" Then

lstbxDirector.Items.Add(DropDownList2.SelectedValue)

ElseIf DropDownList1.SelectedValue = "Others" Then
txtDirectorname.Focus()
End If


End Sub

Protected Sub btnAddNewDirector_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddNewDirector.Click
lstbxDirector.Items.Add(txtDirectorname.Text)
End Sub

Protected Sub btnDeleteActor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDeleteActor.Click
lstbxActor.Items.Clear()
End Sub

Protected Sub btnDeleteDirector_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDeleteDirector.Click
lstbxDirector.Items.Clear()
End Sub
End Class
AnswerRe: asp.net n access database Pin
Christian Graus18-Jun-07 20:28
protectorChristian Graus18-Jun-07 20:28 
GeneralRe: asp.net n access database Pin
ling_luv18-Jun-07 20:30
ling_luv18-Jun-07 20:30 
GeneralRe: asp.net n access database Pin
Christian Graus18-Jun-07 20:32
protectorChristian Graus18-Jun-07 20:32 
GeneralRe: asp.net n access database Pin
ling_luv18-Jun-07 20:34
ling_luv18-Jun-07 20:34 
GeneralRe: asp.net n access database Pin
Christian Graus18-Jun-07 20:37
protectorChristian Graus18-Jun-07 20:37 
GeneralRe: asp.net n access database Pin
ling_luv18-Jun-07 20:38
ling_luv18-Jun-07 20:38 
QuestionWhat shorcut is used in asp.net 1.0 Pin
Hemant Garg18-Jun-07 20:11
Hemant Garg18-Jun-07 20:11 
AnswerRe: What shorcut is used in asp.net 1.0 Pin
Sathesh Sakthivel18-Jun-07 20:15
Sathesh Sakthivel18-Jun-07 20:15 
QuestionAJAX doubt Pin
saravanan0518-Jun-07 20:09
saravanan0518-Jun-07 20:09 
AnswerRe: AJAX doubt Pin
Sathesh Sakthivel18-Jun-07 20:12
Sathesh Sakthivel18-Jun-07 20:12 
AnswerRe: AJAX doubt Pin
Christian Graus18-Jun-07 20:33
protectorChristian Graus18-Jun-07 20:33 
QuestionHow to handle events of dynamic controls Pin
Sapan Roy18-Jun-07 20:09
Sapan Roy18-Jun-07 20:09 
AnswerRe: How to handle events of dynamic controls Pin
Sandeep Akhare18-Jun-07 20:52
Sandeep Akhare18-Jun-07 20:52 
Questionhow to show gridview with out data Pin
findtango18-Jun-07 19:56
findtango18-Jun-07 19:56 
AnswerRe: how to show gridview with out data Pin
N a v a n e e t h18-Jun-07 20:04
N a v a n e e t h18-Jun-07 20:04 
AnswerRe: how to show gridview with out data Pin
manojch218-Jun-07 20:33
manojch218-Jun-07 20:33 
Questionwriting in texbox thru coding is a problem Pin
Hemant Garg18-Jun-07 19:37
Hemant Garg18-Jun-07 19:37 

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.