|
I realy don't have much time, so please answer me quickly!
I need a simple example on how do I put the result of an sql query into a DataGridView.
|
|
|
|
|
Use
SqlConnection con=new SqlConnection(ConnectionStringBuilder.Make());<br />
string str_SQL ="SELECT * FROM Shop_ProDetails "<br />
SqlCommand cmd=new SqlCommand(str_SQL,con);<br />
SqlDataAdapter da=new SqlDataAdapter(cmd);<br />
DataTable tb=new DataTable("tb");<br />
da.Fill(tb); <br />
dgr_Products.DataSource=tb;
dgr_Products.DataBind();
|
|
|
|
|
|
How do I add the possibility to edit only one collumn of the generated table?
How do I add the possibility to delete rows?
Thanks!
|
|
|
|
|
If you search Google (or even Code Project) you'll probably find thousands of examples of databinding to a dataset to a datagridview.
andrei_dalcu wrote: How do I add the possibility to edit only one collumn of the generated table?
Set all other DataGridViewColumns ReadOnly property to true except for the one you want to edit
andrei_dalcu wrote: How do I add the possibility to delete rows?
In the DataGridView, AllowUserToDeleteRows should be set to true (which is the default) then when a user selects a row and presses delete the row will disappear. If you want to actually delete it from the database then you need to set up your DataAdapters DeleteCommand and when you want to delete you will need to use the Update method - again, try Google for lots of examples or even MSDNs documentation is pretty decent.
|
|
|
|
|
my application has a usercontrol that contains 3 panels.
there are a flash object on my main form , contains 3 button, i want hide and show that panel on usercontrol according to commands that falsh object send!!!
i call a method from usercontrol in my form that changes visibility of panels
but doesn't work.
Please Help me
on form :
<br />
private void AXSWMenu_FSCommand(object sender, AxShockwaveFlashObjects._IShockwaveFlashEvents_FSCommandEvent e)<br />
{<br />
CtlSimpleHtml find_suitableAction =new CtlSimpleHtml();<br />
find_suitableAction.load_html(e.args.ToString());<br />
<br />
}
on usercontrol:
<br />
public void load_html(string command_type)<br />
{<br />
if (command_type.Trim()=="Bio")<br />
{<br />
fill_author_name_forBio();<br />
pnl_viewer.Hide();
pnl_Story.Hide();
pnl_AuthorName.Show();
pnl_AuthorName.Location=new Point(8,8); <br />
pnl_viewer.Location=new Point(8,672);<br />
pnl_AuthorName.Update();<br />
pnl_Story.Update();<br />
pnl_viewer.Update(); <br />
}<br />
}<br />
<br />
public void fill_author_name_forBio()<br />
{<br />
Authors name =new Authors();<br />
DataTable Authors_name=name.find_AuthorsName_all(connection.make());<br />
li_AuthorName.DataSource=Authors_name;<br />
li_AuthorName.DisplayMember="Name";<br />
li_AuthorName.ValueMember="id";<br />
li_AuthorName.SelectedIndex=-1;<br />
}<br />
In Classes:
Authors:
<br />
public class Authors<br />
{<br />
OleDbConnection con;<br />
OleDbCommand cmd;<br />
public DataTable find_AuthorsName_all(string cnstring)<br />
{<br />
con=new OleDbConnection(cnstring);<br />
try<br />
{<br />
con.Open();<br />
string cmdstr="select name,id from Authors ";<br />
cmd=new OleDbCommand(cmdstr,con);<br />
cmd.CommandType=CommandType.Text;<br />
OleDbDataAdapter adp=new OleDbDataAdapter(cmd);<br />
DataTable dt =new DataTable("Authors");<br />
adp.Fill(dt);<br />
con.Close();<br />
return dt;<br />
}<br />
catch(Exception ex)<br />
{<br />
MessageBox.Show(ex.Message);<br />
con.Close();<br />
return null;<br />
}<br />
}<br />
}<br />
|
|
|
|
|
firstly creat object of usercontrol in ur form(make sure panels are of public modifier) and add the control in form
muhammad mahmood ilyas
|
|
|
|
|
Juz create a object of usercontrol in main form and make the panel as public in user control. Use the usercontrol object in mainform to hide or show.
like
uctrlobj.panel1.visible=true;<br />
uctrlobj.panel2.visible=false;
Hope u got it.
Sri
|
|
|
|
|
when a file is created, all information (file name, creation date, size etc) are stored anywhere.
so keeping these points in mind,
how these information can be accessed.
these information is also called signature of a file.
muhammad mahmood ilyas
|
|
|
|
|
Use:
FileInfo fi = new FileInfo(@"c:\test.xml");
|
|
|
|
|
You asked the same question 1 hr before posting this question and were given the answer then. Please dont repost!
Current blacklist
svmilky - Extremely rude | FeRtoll - Rude personal emails | ironstrike1 - Rude & Obnoxious behaviour
|
|
|
|
|
I try to do my homepage,but i poor in CODE,thank all give idea or advice,about study C#...
|
|
|
|
|
Simply, open book begin to erad and practice what u read
|
|
|
|
|
I would play games as soon as i was free,and pay little time on CODE.
|
|
|
|
|
go to bed and think upon c# before sleeping hopefully u will see in dream about ur solution:->
muhammad mahmood ilyas
|
|
|
|
|
Your suggestions are prone to criticisms, especially the theoretical assumptions about how the mind is at work.
|
|
|
|
|
1) Open VS.net 2005.
2) Mash Face on keyboard for 1-2 minuites
3) Bandage Face
4) Press "Compile"
5) Debug
Repeat steps 4-5 until your program works.
|
|
|
|
|
Hello everybody,
I'm working on a C# application (.Net framework 1.1) that is gonna be used as
an HTML editor.It uses Microsoft MSHTML API for editing HTML pages. Now most
of the job looks good and it is dealing fine with Bold , Italic, Underline,
Open file, Save file and other features as well. The problem is that I can
not find a way to insert a <table> element into the page(HTML document) or
edit an existing TABLE at run time. Anybody got a clue?
TIA
yours,
P.Assadi M.D.
|
|
|
|
|
Actually it was solved in a way, you can add "Table" tags as STRING
and add them to document.innerHTML. they will be recognized as an HTML
element.
thanks anyway
P.Assadi M.D.
|
|
|
|
|
I have a database containing a many-to-many relationship and want to display it using two datagrids in the usual master-detail style. For illustration let's say I have a movie table, an actor table and an appearsIn relation table representing the many-to-many relationship between movies and actors. The master datagrid should display movies and the details datagrid should display all actors that appear in the selected movie. The number of actors that can appear in a movie could be in the thousands, so selecting the actors to display must be efficient. It appears that .Net directly supports one-to-many relationships, but not many-to-many relationships, and thus I can't seem to find an obvious solution which is efficient and elegant. I've tried filtering the actors table using rowfilter like this "id in (1,2,7,9,.....)" but that's way too slow if the number of ids to filter on gets very big.
Any suggestions?
|
|
|
|
|
Hi to all.My query is
what is the spyware signatures and how to access in c#.
show me some sites from whitch i can get help about Anti spyware development in c#. Thanks to all.
-- modified at 8:19 Wednesday 7th June, 2006
|
|
|
|
|
Hi,
actually, malware signature (in this case spyware signature) is a set of parameters that helps you recognize whether the specific file is malware or not. Basically, it may be a unic sequence of bytes, specific for that file or for that malware family.
In case you want to develope your own anti-malware tool you should, first of all, learn the PE (portable executable) file format, you may find the needed documentation on MSDN.
Unfortunately, you'll have to build your own signature database, because all the AV vendors keep their sigs in secret.
You should use simple binary IO (System.IO namespace) for accessing the files (those you think are malicious) and your signature database.
cheers,
Alexey
|
|
|
|
|
hi all.
how to get information hidden in the header of a file
or
how to get information about the signature (name, version, creation date, modified date etc)of a file
muhammad mahmood ilyas
|
|
|
|
|
Depends on the file type. For a description of file types you might check this link.
Basically you craete a BinaryReader . You can then read the complete header with ReadBytes(count) and convert them yourself, or you can read them information by information, like ReadInt , ReadBoolean etc.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
u can try
System.IO.FileInfo fl = new System.IO.FileInfo("full path of file");
and from this fl object u can check name, version, creation date, modified date etc of that file
rahul
|
|
|
|