| |
|||
Сначала из базы данных извлекаются названия всех категорий:
"Categories")
DSPageData.Tables("Categories").DefaultView ddlCategorylD.DataBind()
D.im DBConn as OleDbConnection Dim DBInsert As New OleDbCommand Dim DBCommand As OleDbDataAdapter Dim DSNewID as New DataSet DBConn = New OleDbConnection("Provider=sqloledb;" _ & "server=localhost;" _ & "Initial Catalog-INETCH;" & "User Id=sa;" & "Password-yourpassword;") DBInsert.CommandText = "Insert Into Classifieds (" _ & "CategoryiD, TitleText, DatePlaced, Price, " _ & "Description, EmailAddress, Password) values (" _ & ddlCategorylD.Selectedltem.Value & ", " _ & ""' & Replace (txtTitleText. Text, "'", """) & '", " & " ' " & Today () & " ', " _ & "'" & Replace(txtPrice.Text, ....., "'"')& "', " _ & '"" & Replace (txtDescription. Text, "•","'•••) &"',"_ & "'" & Replace(txtEmailAddress.Text, "'", "''") & "', " & "'" & Replace (txtPassword.Text, ""', "''") & "')" DBInsert.Connection = DBConn DBInsert.Connection.Open DBInsert.ExecuteNonQuery() DBCommand = New OleDbDataAdapter _ ("Select Max(ClassifiedlD) as ThelD from Classifieds" _ , DBConn) DBCommand.Fill(DSNewID, _ "ThelD") pnlForm.Visible = False IblMessage.Text = "Ваше объявление размещено. " _ & "Для его удаления запомните код ID: " _ & DSNewID.Tables("ThelD").Rows(0).Item("TheID") & " и пароль: " _ & txtPassword.Text _ & "<BR><A HREF=""./index.азрх"">Домашняя страница</А>" End Sub
& "CategorylD, TitleText, DatePlaced, Price, " _ & "Description, EmailAddress, Password) values (" _ & ddlCategorylD,.Selectedltem.Value & ", " _ & "'" & Replace(txtTitleText.Text, "'", "'"') & "', " _ & "'" & Today() &"',"_ & "'" & Replace (txtPrice.Text, "'", "'"') & "', " _ & "'" & Replace (txtDescription. Text, "'", '""') & "', " _ & "'" & Replace(txtEmailAddress.Text, "'", "''") & "', " _ & '"" & Replace (txtPassword.Text, '"", """) & "')" DBInsert.Connection = DBConn DBInsert.Connection.Open DBInsert.ExecuteNonQuery()
("Select Max(ClassifiedlD) as ThelD from Classifieds" _ , DBConn)
"ThelD")
& "Для его удаления запомните код ID: " & DSNewID.Tables("ThelD").Rows{0).ltem("TheID") _ & " и пароль: " _ & txtPassword.Text _ & "<BR><A HREF=""./index.азрх"">Домашняя страница</А>" |
|||