填充Richtextbox [英] Populating a Richtextbox

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

问题描述

Winforms应用程序


Winforms application


rtxt.Text = "SELECT  Title, Rating, CategoryCode, Description FROM tblMovieTitles WHERE (Rating = '" + this.chklCode.Text + "' ) AND (CategoryCode =";

//Add the value
//Do loop on all selected items
// AND/OR (CategoryCode = lstCategorie[x].value ;

                
rtxt.Text += ")";
   
scmd = new SqlCommand(rtxt.Text, conn);



我是否想念上面的东西?
我在表中有一个描述"列和一个类别代码"列.我已经在列表框中填充了描述".我要的是单击列表框中的描述".
richtextbox应填充描述"(Description)值的相关"categoryCode".并将其值拉入RTF文本框中.

例如:我的富文本框应显示为..

CategoryCode = ??????????

请更正我的代码或添加适当的内容.请不要给予理论建议.

[修改:添加了前置标记...他们是您的朋友]



Do i missing something above.
I have a "Description" column and a "categoryCode" column in a table. I have populated the "Description" in a listbox. what i want is when i click the "Description" in listbox.
The richtextbox should populate the related "categoryCode" of the "Description" value. and the value should be pulled in richtext box.

Ex: My rich text box should appear as..

CategoryCode = ??????????

Please correct my code or add something appropriate.. Please don''t give THEORY advise.

[Modified: added pre tags...they are your friend]

推荐答案

您知道这句话:您可以给男人一条鱼,他会吃一天,但教他如何钓鱼,他将能够终生食用"?

如果我们只修复您的代码,那么下次遇到问题时,您将立即回到这里.为您提供理论是回答问题的最佳方法.

但是,实际上,我不确定如何回答您的问题,因为您的问题还不清楚.

但是,根据您提供给我们的信息,您无需设置类别代码.所以,是的,您错过了一些东西...

仅供参考,如果我是你,我会用Google进行"SQL注入攻击".因为您的代码容易受到chk1Code控件类型的影响.
you know the saying, "you can give a man a fish and he''ll eat for a day, but teach him how to fish and he''ll be able to eat for life"?

if we just fix your code, then you''ll just be right back here the next time you have a problem. Providing you with theory is the best way to answer your question.

But, really, I''m not sure how to answer your question because your question is quite unclear.

But with what you provided us, you don''t ever set the category code. So, yes, you missed something...

FYI, if I were you, I would google "SQL injection attack". Because your code is susceptible depending on what type of control chk1Code is.


这篇关于填充Richtextbox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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