|
I have a 100MB database of SQLServer. When I made a datagridview using DatagridViewColumnCombox in order that user can choose an item in combobox. When I choose an item, it seems to load data into combobox column. It cause my app running so slowly although this column contains a field about over 1000 records....
Somebody could help me explain why VS.NET uses cache but my app runs slowly
I assume that if I made a combo box and then attached it into datagridview, it ưould seem slower. But, I don't know how to do it....
Sorry about my poor English
Thanks in advance ...
It seem to be a solution or an answer.
|
|
|
|
|
phantanagu wrote: When I choose an item, it seems to load data into combobox column.
It *seems* to ? What code have you written, that you're not sure if it does, or not ?
If you take the SQL that's being run, and run it in SQL Server, how fast is it ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: It *seems* to ? What code have you written, that you're not sure if it does, or not ?
I only assign datasource to combobox column using dataset object,I don't write any code. Because list of items appears slow so I think everytime I select an item in new row, combo box also loads data.
Christian Graus wrote: If you take the SQL that's being run, and run it in SQL Server, how fast is it ?
I am sure that if I run it in SQLServer, it makes me content with speed. If I use a favourite combox, loading of data is OK. But when using DatagridColumnComboBox, I confuse it...
It seem to be a solution or an answer.
|
|
|
|
|
Did you write code to load the data or you've drag/drooped in VS.NET a connection/dataset and so on?
http://stefanprodan.wordpress.com
|
|
|
|
|
I know i can add an IE web browser to a c# app using the Microsoft Web Browser Component, can i do the same to add a Firefox browser?
If not, how would i go about manipulation the Microsoft Web Browser to look like firefox? Ie.. by referencing the Mozilla standards?...
Thanks Heaps
|
|
|
|
|
Search for Mozilla ActiveX. That is an ActiveX component just like Internet Explorer, you can plop it on your form the same way.
|
|
|
|
|
Thanks heaps 
|
|
|
|
|
Hello
How do i modify my C# form in such a way that every time I run it, it will automatically maximize and fit the screen?
thanks in advance 
|
|
|
|
|
In the designer, the form has a WindowState property. Set it to Maximised.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
got it. thanks! 
|
|
|
|
|
good evning every one..i really need ur help guys ..my program like that one in Paint ..finally i can save the file as text in C DRIVE but while opening it can read the data from text but cant display it ( draw the lines..)..note it can save & open the lines only.
---> my question : how can i make the program display the file.
this apart of my code guys :
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
using System.Data;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Serialization;
namespace graphics_practis
{
///
/// Summary description for Form1.
///
public class Form1 : System.Windows.Forms.Form
{
Point center,radius,v,start,end,a,b;
ArrayList arraypoint=new ArrayList();
ArrayList arraylist_points=new ArrayList();
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button line;
private System.Windows.Forms.Button square;
private System.Windows.Forms.Button circle;
private System.Windows.Forms.Button ellipse;
private System.Windows.Forms.Button polygon;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button ok;
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem menuItem3;
private System.Windows.Forms.MenuItem menuItem4;
private System.Windows.Forms.MenuItem menuItem5;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
private BinaryFormatter formtter = new BinaryFormatter();
///
/// Required designer variable.
///
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
dr = new draw(this.pictureBox1);
}
///
/// Clean up any resources being used.
///
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.panel1 = new System.Windows.Forms.Panel();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.line = new System.Windows.Forms.Button();
this.square = new System.Windows.Forms.Button();
this.circle = new System.Windows.Forms.Button();
this.ellipse = new System.Windows.Forms.Button();
this.polygon = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.ok = new System.Windows.Forms.Button();
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.menuItem4 = new System.Windows.Forms.MenuItem();
this.menuItem5 = new System.Windows.Forms.MenuItem();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
this.panel1.BackColor = System.Drawing.SystemColors.MenuText;
this.panel1.Controls.Add(this.pictureBox1);
this.panel1.Location = new System.Drawing.Point(96, 32);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(416, 296);
this.panel1.TabIndex = 0;
//
// pictureBox1
//
this.pictureBox1.BackColor = System.Drawing.SystemColors.Window;
this.pictureBox1.Location = new System.Drawing.Point(0, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(416, 296);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
this.pictureBox1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseUp);
this.pictureBox1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseMove);
this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseDown);
//
// line
//
this.line.Location = new System.Drawing.Point(24, 32);
this.line.Name = "line";
this.line.Size = new System.Drawing.Size(40, 23);
this.line.TabIndex = 1;
this.line.Text = "line";
this.line.Click += new System.EventHandler(this.line_Click);
//
// square
//
this.square.Location = new System.Drawing.Point(24, 72);
this.square.Name = "square";
this.square.Size = new System.Drawing.Size(40, 23);
this.square.TabIndex = 2;
this.square.Text = "square";
this.square.Click += new System.EventHandler(this.square_Click);
//
// circle
//
this.circle.Location = new System.Drawing.Point(24, 120);
this.circle.Name = "circle";
this.circle.Size = new System.Drawing.Size(48, 23);
this.circle.TabIndex = 3;
this.circle.Text = "circle";
this.circle.Click += new System.EventHandler(this.circle_Click);
//
// ellipse
//
this.ellipse.Location = new System.Drawing.Point(24, 168);
this.ellipse.Name = "ellipse";
this.ellipse.Size = new System.Drawing.Size(56, 23);
this.ellipse.TabIndex = 4;
this.ellipse.Text = "ellipse";
this.ellipse.Click += new System.EventHandler(this.ellipse_Click);
//
// polygon
//
this.polygon.Location = new System.Drawing.Point(16, 216);
this.polygon.Name = "polygon";
this.polygon.Size = new System.Drawing.Size(56, 23);
this.polygon.TabIndex = 5;
this.polygon.Text = "polygon";
this.polygon.Click += new System.EventHandler(this.polygon_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(8, 264);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(40, 20);
this.textBox1.TabIndex = 6;
this.textBox1.Text = "";
//
// ok
//
this.ok.Location = new System.Drawing.Point(48, 264);
this.ok.Name = "ok";
this.ok.Size = new System.Drawing.Size(32, 23);
this.ok.TabIndex = 7;
this.ok.Text = "ok";
this.ok.Click += new System.EventHandler(this.ok_Click);
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem2,
this.menuItem3,
this.menuItem4,
this.menuItem5});
this.menuItem1.Text = "File";
//
// menuItem2
//
this.menuItem2.Index = 0;
this.menuItem2.Text = "New";
//
// menuItem3
//
this.menuItem3.Index = 1;
this.menuItem3.Text = "Open";
this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
//
// menuItem4
//
this.menuItem4.Index = 2;
this.menuItem4.Text = "Save";
this.menuItem4.Click += new System.EventHandler(this.menuItem4_Click);
//
// menuItem5
//
this.menuItem5.Index = 3;
this.menuItem5.Text = "Exit";
this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(192, 344);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(192, 32);
this.button1.TabIndex = 8;
this.button1.Text = "Change Text Color";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(192, 384);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(192, 32);
this.button2.TabIndex = 9;
this.button2.Text = "Change Background Color";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(528, 445);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.ok);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.polygon);
this.Controls.Add(this.ellipse);
this.Controls.Add(this.circle);
this.Controls.Add(this.square);
this.Controls.Add(this.line);
this.Controls.Add(this.panel1);
this.Menu = this.mainMenu1;
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
///
/// The main entry point for the application.
///
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
#region variables
Graphics g ;
Pen p = new Pen(Color.Black,1);
ArrayList lines = new ArrayList();
ArrayList squeres = new ArrayList();
ArrayList circles = new ArrayList();
ArrayList ellipses = new ArrayList();
ArrayList polygons = new ArrayList();
int drawwhat;
int n ;//for the No. of polygon
draw dr;
#endregion
#region mouse down
private void pictureBox1_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
start.X = e.X;
start.Y = e.Y;
arraylist_points.Add(start);
}
#endregion
#region mouse move
private void pictureBox1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
g = pictureBox1.CreateGraphics();
if(e.Button == MouseButtons.Left)
{
refresh();
DrawReq(new Point(e.X,e.Y));
}
}
#endregion
#region mouse_up
private void pictureBox1_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
{
if(e.Button == MouseButtons.Left)
{
end.X = e.X;
end.Y = e.Y;
DrawReq();
arraylist_points.Add(end);
}
}
#endregion
#region FormLoad
private void Form1_Load(object sender, System.EventArgs e)
{
Bitmap bmp =
new Bitmap(pictureBox1.Width,
pictureBox1.Height);
pictureBox1.BackgroundImage = bmp;
g = Graphics.FromImage(bmp);
g.Clear(pictureBox1.BackColor);
}
#endregion
private void line_Click(object sender, System.EventArgs e)
{
drawwhat = 1;
}
#region Drawwhat
private void DrawReq()
{
if(drawwhat == 1)
{
dr.line(p,start,end);
Line l = new Line();
l.Pen = p;
l.First = start;
l.Second = end;
lines.Add(l);
l = null;
}
else if(drawwhat == 2)
{
dr.square(new Pen(Color.Black,1),start,end);
Line l = new Line();
l.Pen = p;
l.First = start;
l.Second = end;
squeres.Add(l);
l = null;
}
else if(drawwhat == 3)
{
dr.circle(p,start,end);
Line l = new Line();
l.Pen = p;
l.First = start;
l.Second = end;
circles.Add(l);
l = null;
}
else if(drawwhat == 4)
{
dr.ellipse(p,start,end);
Line l = new Line();
l.Pen = p;
l.First = start;
l.Second = end;
ellipses.Add(l);
l = null;
}
else if (drawwhat == 5 && n!=0)
{
dr.polygon(n,p,start,end);
Polygon np = new Polygon();
np.Pen = p;
np.First = start;
np.Second = end;
np.n = n;
polygons.Add(np);
np = null;
}
}
//______________________________________________________________
private void DrawReq(Point last)// overloading to draw during moving
{
end = last;
if(drawwhat == 1)
{
dr.line(p,start,end);
}
else if(drawwhat == 2)
{
dr.square(p,start,end);
}
else if(drawwhat == 3)
{
dr.circle(p,start,end);
}
else if(drawwhat == 4)
{
dr.ellipse(p,start,end);
}
else if (drawwhat == 5)
{
dr.polygon(n,p,start,end);
}
}
//________________________________________________________________
//________________________________________________________________
#endregion
#region Refresh
private void refresh()
{
pictureBox1.Refresh();
foreach(Line l in lines)
{
dr.line(l.Pen,l.First,l.Second);
}
foreach(Line l in squeres)
{
dr.square(l.Pen,l.First,l.Second);
}
foreach(Line l in circles)
{
dr.circle(l.Pen,l.First,l.Second);
}
foreach(Line l in ellipses)
{
dr.ellipse(l.Pen,l.First,l.Second);
}
foreach(Polygon p in polygons)
{
dr.polygon(p.n,p.Pen,p.First,p.Second);
}
}
#endregion
private void square_Click(object sender, System.EventArgs e)
{
drawwhat = 2;
}
private void circle_Click(object sender, System.EventArgs e)
{
drawwhat = 3;
}
private void pictureBox1_Click(object sender, System.EventArgs e)
{
}
private void ellipse_Click(object sender, System.EventArgs e)
{
drawwhat = 4;
}
private void polygon_Click(object sender, System.EventArgs e)
{
drawwhat = 5;
}
private void ok_Click(object sender, System.EventArgs e)
{
try
{
n = int.Parse(textBox1.Text.ToString());
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void menuItem4_Click(object sender, System.EventArgs e)
{
// save the file
string str_Line;
System.IO.FileStream fs = new System.IO.FileStream("c:\\graphics.txt", System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);
StreamWriter streamWriter=new StreamWriter(fs);
if(drawwhat==1)
{
for(int j=0;j
|
|
|
|
|
No-one is going to read all of this.
mr jets wrote: private void menuItem3_Click(object sender, System.EventArgs e)
{
//open the file
string str_reader;
if(openFileDialog1.ShowDialog()==DialogResult.OK)
{
StreamReader streamReader=new
StreamReader(openFileDialog1.FileName);
str_reader=streamReader.ReadToEnd();
MessageBox.Show(str_reader);
streamReader.Close();
}
This code assigns your file contents to a string, which you then discard ( it's a local variable, so it disappears after the function ends ). By what process did you expect your program to do anything with this data ?
mr jets wrote: for(int j=0;j {
streamWriter.WriteLine("Line");
start=(Point)arraylist_points[j];
end=(Point)arraylist_points[j+1];
str_Line=start.ToString()+end.ToString();
streamWriter.WriteLine(str_Line);
j++;
}
streamWriter.Flush();
streamWriter.Close();
fs.Close();
You need to reverse this process and fill your array of points with the data you've read in.
Your program is not like Paint. Paint deals in raster info, you're doing a drawing package.
You shouldn't use a picture box, that's a waste of time, write your own handler for the paint message.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
heloo christian ..u are my hero man ..there was awrong with my save code..:
// save the file
string str_Line;
System.IO.FileStream fs = new System.IO.FileStream("c:\\graphics.txt", System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);
StreamWriter streamWriter=new StreamWriter(fs);
if(drawwhat==1)
{
for(int j=0;j
|
|
|
|
|
mr jets wrote: about my open code what should i do to make the program display the file after reading the data from the text..?
Like I said, you need to parse the text and use it to fill your array of points. It really seems to me like you probably need an array of instances of a struct that contains all the data you need to draw different items, I thought I saw you drawing polygons, etc ? But, either way, what ever you store in your array, you need to repopulate. Your drawing code draws based on that array, right ? So how can it draw if you don't populate that array with the data ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
On some client's computer the XmlDocument.Save() fails with some weird internal error such as:
==============
Exception : System.IO.IOException
Message : Unknown error "-1".
Source : mscorlib
Help :
Stack :
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
at System.Xml.XmlDocument.Save(String filename)
===============
I have reported such a problem to microsft and they just told me they need more information such as a mini dump.
how do I do one?
|
|
|
|
|
|
Hi,
I have a big problem, I hope you can help me with.
What I want:
A forum where there is 3 columns Subject, AnswersCount, LastAnswer
I have one table with all the data. And two selects functions, where I on the first, get all Subjects for all questions, and on the second select get the Count for all answers on a specific question (with input quiestionId). Both functions works perfect, when I use them seperatly.
But I have to go through all rows in the first selection to find the Count
What shall I do to that?
The code I have now is:
The Repeater, where I want to put all data into:
<asp:repeater id="repDebatIndlaeg" runat="server">
<headertemplate>
Antal indlæg ialt:
<asp:label id="lblIndlaegIalt" runat="server" text="Label">
| |
|
<itemtemplate>
<footertemplate>
| | Emne
| | Antal indlæg
| | Seneste indlæg
|
| | <asp:hyperlink id="lnkEmne" runat="server" text="<%# Eval("Overskrift") %>" navigateurl="<%# "~/Debat.aspx?id=" + Eval("DebatId") %>">
| | <asp:label id="lblAntalIndlaeg" runat="server" text="<%# Eval("DebatNr") %>">
| | <asp:label id="lblSenesteIndlaeg" runat="server" text="<%# Eval("Dato") %>">
|
|
|
The codebehind:
protected void Page_Load(object sender, EventArgs e)
{
DebatApi debatapi = new DebatApi();
if (!IsPostBack)
{
try
{
DataTable Debat = null;
if (debatapi.GetDebat(ref Debat) == Status.Success)
{
int tael = 0;
for (int i = 0; i < Debat.Rows.Count; i++)
{
tael = Convert.ToInt32(Debat.Rows[i]["DebatId"]);
DataTable DebatCount = null;
if (debatapi.GetCountAnswers(tael, ref DebatCount) == Status.Success)
{
}
}
repDebatIndlaeg.DataSource = Debat.DefaultView;
repDebatIndlaeg.DataBind();
}
}
catch
{
}
}
debatapi.Dispose();
}
What shall I put into here so I can write the output into the repeater:
if (debatapi.GetCountAnswers(tael, ref DebatCount) == Status.Success)
{
}
If it was a label outside an repeater, I would make something like:
lblAntalIndlaeg.Text = Convert.ToInt32(GetKontoplanFuld.Rows[i]["DebatNr"]);
But VS cann't finde the lblAntalIndlaeg
I hope someone can help me....Im pretty desperat....
Kind regards,
simsen 
|
|
|
|
|
Hello everyone,
I am using Directshow API in Visual C# enviroment. I am using the following code to toggle Full-Screen. My problem is that when I have the Full-Screen mode, my courser disapears! Can someone tell me how I can have my Courser visiable in the Full-Screen mode?
void ToggleFullScreen()<br />
{<br />
if( videoWin == null )<br />
return;<br />
<br />
int mode;<br />
int hr = videoWin.get_FullScreenMode( out mode );<br />
if( mode == DsHlp.OAFALSE )<br />
{<br />
mode = DsHlp.OATRUE;<br />
hr = videoWin.put_FullScreenMode( mode );<br />
if (hr >= 0)<br />
{<br />
fullScreen = true;<br />
}<br />
}<br />
else<br />
{<br />
mode = DsHlp.OAFALSE;<br />
hr = videoWin.put_FullScreenMode( mode );<br />
if (hr >= 0)<br />
{<br />
fullScreen = false;<br />
}<br />
this.TopMost = true;<br />
this.Refresh();<br />
}
Thank you very much and have a great day.
Khoramdin
|
|
|
|
|
1) Before toggling to full screen mode, store a reference to your main window.
2) then handle mouse_move events
3) call Cursor.Draw(..) to draw it on the form as (source code from MSDN Library):
private void DrawCursorsOnForm(Cursor cursor)
{
// If the form's cursor is not the Hand cursor and the
// Current cursor is the Default, Draw the specified
// cursor on the form in normal size and twice normal size.
if(this.Cursor != Cursors.Hand &
Cursor.Current == Cursors.Default)
{
// Draw the cursor stretched.
Graphics graphics = this.CreateGraphics();
Rectangle rectangle = new Rectangle(
new Point(10,10), new Size(cursor.Size.Width * 2,
cursor.Size.Height * 2));
cursor.DrawStretched(graphics, rectangle);
// Draw the cursor in normal size.
rectangle.Location = new Point(
rectangle.Width + rectangle.Location.X,
rectangle.Height + rectangle.Location.Y);
rectangle.Size = cursor.Size;
cursor.Draw(graphics, rectangle);
// Dispose of the cursor.
cursor.Dispose();
}
}
this is the first idea I had after 11 hours of non-stop programming, hope it helps...
|
|
|
|
|
Hi, there!
I can't Update a table in database after a row is deleted in DataSet.
I delete a row, as following:
DataRow[] usersRows;<br />
usersRows = ContactsDataSet.Users.Select("UserName = '" + userName + "'");<br />
foreach (DataRow userRow in usersRows)<br />
userRow.Delete();
and I tried to update the database:
DataSetTableAdapters.UsersTableAdapter usersTableAdapter = new DataSetTableAdapters.UsersTableAdapter();<br />
usersTableAdapter.Update(contactsDataSet.Users);
But the data aren't updated.
Can someone help me?
Thank you in advance.
--
Adrián Córdoba
|
|
|
|
|
aecordoba wrote: usersRows = ContactsDataSet.Users.Select("UserName = '" + userName + "'");
OT: This is dangerous for sql injection attacks...
|
|
|
|
|
First: make sure that the rows are really deleted from the datatable.
Second: What is the deletecommand for the dataadapter?
|
|
|
|
|
The DeleteCommand was automaticaly generated by Visual Studio 2005.
I think the problem is the Deleted status of the rows is in DataSet.
I'm sorry. I'm newbie.
--
Adrián Córdoba
|
|
|
|
|
Don't assume the value came from an untrusted source.
|
|
|
|
|
PIEBALDconsult wrote: Don't assume the value came from an untrusted source.
It's safer to assume it is untrusted...
|
|
|
|
|