دوستان ممنون میشم اگه نحوه اتصال freeTextBox را به دیتابیس رو توضیح بدین
Printable View
دوستان ممنون میشم اگه نحوه اتصال freeTextBox را به دیتابیس رو توضیح بدین
این مثال شاید به دردتون بخوره خودم با این نرم افزار کار نکردم ولی فکر کنم با ویژوال استودیم در کد نویسی تفاوتی نداره اگر asp.net کار میکنید
[PHP] This example uses a connected model design to the database, doesn't use stored procedures, and the db connection string is in the code, this is not desirable for scalability, but it is easy to understand and implement on small projects. You can easily see the connection string to an Access database, and you can get an idea of the form layout that will be in your aspx page. Was written in C#, then used some online converter to get it to VB.NET, so I hope it works for you. Also, uiTxtBody is the id name of the FreeTextBox control in the aspx page.
Protected Sub addArticle(ByVal sender As Object, ByVal e As EventArgs)
Try
Dim connStr As String = Server.MapPath("../App_Data/AccessDatabase.mdb")
Dim txtBody As String = uiTxtBody.Text.Replace("'","''")
Dim conn As OleDbConnection = New OleDbConnection("Provider=Microsoft.JET.OLEDB.4.0; data source=" + connStr)
conn.Open()
String sql = "INSERT INTO tblNews ( Title, Body, Author, Date1, Display_Date, " +
" Expire_Date, Priority) Values('" + txtBody +
"','" + txtBody +
"','" + uiTxtAuthor.Text.Replace("'", "''") +
"','" + Convert.ToDateTime(uiTxtDateDisplay.Text) +
"','" + Convert.ToDateTime(uiTxtDateDisplay.Text) +
"','" + Convert.ToDateTime(uiTxtDateExpire.Text) +
"','" + Convert.ToInt32(uiLstPriority.SelectedValue) + "')"
Dim cmd As OleDbCommand = New OleDbCommand()
cmd.Connection = conn
cmd.CommandText = sql
cmd.ExecuteNonQuery()
tblAddNews.Visible = False
uiBtnDisplayAdd.Visible = True
Catch err As System.FormatException
uiLblErrPriority.Visible = True
End Try
End Sub [/PHP]