RichTextBox访问数据库表 [英] RichTextBox To Access Database Table

查看:91
本文介绍了RichTextBox访问数据库表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮我了解我对从访问数据库中的richtextbox记录的数据的更正代码.


为每个记录
因此Richtextbox可以是无尽的文字行
该名称每隔5行重复一次
每隔5行重复一次姓氏
每隔5线重复通话一次
每隔五行重复一次地址

我想我可以使用for循环解决此问题

please help me about my correction code to data recorded from richtextbox in access databse.


recorded for each
so the richtextbox can be endless lines of text
where the name is repeated every next 5 lines
where the surname is repeated every next 5 lines
where the phone is repeated every next 5 lines
where the address is repeated every next 5 lines

I think I could solve this with a for loop

Dim Cmd As OleDbCommand
       Dim SQL As String
       Dim objCmd As New OleDbCommand

       Dim bazaufolderu As String = Application.StartupPath & "\Database.mdb"
       Dim konekcija = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & bazaufolderu)

       Dim red As String
       For x As Integer = 0 To RichTextBox2.Lines.Length Step 4
           RichTextBox2.SelectionStart = x
           '' RichTextBox2.SelectionLength = 10
           ''  red = x + 3


           SQL = "INSERT INTO tblContact (Name,LastName,Phone,Adress) VALUES (''" & RichTextBox2.Text(x) & "'', ''" & RichTextBox2.Text(x) & "'', ''" & RichTextBox2.Text(x) & "'', ''" & RichTextBox2.Text(x) & "'')"
           Cmd = New OleDbCommand(SQL, konekcija)

       Next


       konekcija.Open()
       objCmd = New OleDbCommand(SQL, konekcija)
       objCmd.ExecuteNonQuery()
       MessageBox.Show("SAVE IS OK. Thanks ;-)")
       konekcija.Close()





我试过了,但是不行
查看图像层次: http://imageupload.org/en/file/188327/ioi.jpg.html [ ^ ]
请帮助my.





I tried this but it does not work
view image hier : http://imageupload.org/en/file/188327/ioi.jpg.html[^]
Please help my.

推荐答案

您不应该这样做.它不仅使您的应用程序面临被称为 SQL注入的漏洞利用类型的风险,而且使您的应用程序容易成为此类漏洞利用的目标.我能理解您是否仅出于实验目的.但是,在这种情况下,您的我尝试过但没有用"就无法提供信息.

请参阅: http://en.wikipedia.org/wiki/SQL_injection [
You should not do anything like that. Not only it put your application at risk of well-know type of exploit called SQL injection — it makes your application an easy target for such exploit. I can understand if you are doing it for experimental purpose only. But in this case, your "I tried but it does not work" is not informative.

Please see: http://en.wikipedia.org/wiki/SQL_injection[^].

—SA


想要从richtextbox提交数据以访问被表richtextbox中的列行分开的表.

请参见图片.
http://imageupload.org/en/file/188327/ioi.jpg.html [ ^ ]

我是否可以编写代码
want to submit the data from richtextbox to access a table divided by rows of columns in the table richtextbox.

see the picture.http://imageupload.org/en/file/188327/ioi.jpg.html[^]

whether I could write code


这篇关于RichTextBox访问数据库表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆