|
My delete button doesnt work.
protected void bn_delete_Click(object sender, EventArgs e)
{
foreach (GridViewRow row in GridView1.Rows)
{
int StaffID = Int32.Parse(GridView1.DataKeys[row.RowIndex].Value.ToString());
SqlCommand cmd = new SqlCommand("DELETE FROM Staff Where StaffID = '" + row.RowIndex + "'");
lb_msg.Text = "Record Deleted Successfully.";
GridView1.EditIndex = -1;
GridView1.DataBind();
}
}
|
|
|
|
|
I suggest you do some reading. I don't see any code here that actually calls your command, let alone associates it with a database. Is this the first time you've tried to write DB code ? There's tons of examples on the web, any example on how to use a SqlCommand will do.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
My code is....
DataTable TableTemp=new DataTable();
if (dt.Rows.Count>0)
{
TableTemp.Columns.Add("Name");
TableTemp.Columns.Add("Send_date");
TableTemp.Columns.Add("Numbercurrent");
for(int iCounter=0;iCounter<dt.rows.count;icounter++)>
{
//Dua DL vao Table
DataRow row=TableTemp.NewRow();
row["Name"]=dt.Rows[iCounter]["Name"];
row["Send_date"]=dt.Rows[iCounter]["Send_date"];
row["Numbercurrent"] =xl.Checkdate(DateTime.Parse(dt.Rows[iCounter]["Send_date"].ToString(),DateTime.Now);
TableTemp.Rows.Add(row);
}
}
I want to create Datatable sorted by Numbercurrent but error message Numbercurrent field not exist....
DataTable dtsort = TableTemp.Clone();
foreach (DataRow dr in TableTemp.Select("", "order by Numbercurrent Desc"))
{
dtsort.ImportRow(dr);
}
Please help me solve my problem
|
|
|
|
|
Look into the DataView class
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
I try...
Dataview dv=new Dataview(TableTemp);
dv.sort="order by Numbercurrent desc";
Error message Numbercurrent field no exist ?
Please help me solve my problem
|
|
|
|
|
Hi All,
I'm using SQL Compact 3.5 and LINQ to use a local database in an application. I've automated a process to check that the database exists and is readable before letting the app continue, but I'm now stuck on the best way to implement some form of syncronisation making sure that the database is the right shape.
I'd like to have a class that is able to add or remove tables and columns basically ... a process to make sure that the database matches the context.
What is driving this is that future versions of my application may require amendments to the database and rather than having users go through the process of completely rebuilding the contents of the database it would be much better to have the database altered to match the new context included in the datalayer dll ...
Thanks in advance,
Jammer
Going where everyone here has gone before!
My Blog
|
|
|
|
|
This is going to be used strictly in 2D (on images to be specific) not 3D. I need to be able to divide the image until an end criteria is met using linear lines in any orientation (360 degree range). The internal nodes store the dividing lines, while the leaf nodes contain the average intensity of the region that the node is referring to.
My problem is that I dont know how to store a line segment that is on a specific place. Of course, i need to store the line as well as its location. The leaf nodes just contain a value that will be used to "color" in the region by a BSP tree decoder, but the problem is to store the dividing lines. Would the lines be stored as functions? if so how?
Some background info on BSP tree ftp://ftp.sgi.com/other/bspfaq/faq/bspfaq.html#6.txt[^]
The binary tree that I'm using: http://msdn.microsoft.com/en-us/library/ms379572(VS.80).aspx[^]
|
|
|
|
|
Is it even possible to use an Olap database with an MDX query to retrieve data?
I am trying to do this with the Microsoft.Practices.EnterpriseLibrary.Data.Database object. My first problem begin when using the System.Data.Common.DbProviderFactories object and calling the function GetFactory("Microsoft.AnalysisServices.AdomdClient"). I am getting an exception saying "Unable to find the requested .Net Framework Data Provider. It may not be installed.".
I have installed SQLServer2005_ADOMD.msi so I should have this client installed right? Please help...
Chris
|
|
|
|
|
I'm designing a Windows App in C# that includes a task to execute the FC.exe application and capture its output. The problem is I can't seem to capture any of the output to display in one of my forms. This process works in a Console app but not in a Windows App. I use this same process for executing and capturing other applications output and it works just fine, but can't get it to work for FC.
Process process = new Process();
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.UseShellExecute = false;
process.StartInfo.FileName = "fc";
process.StartInfo.Arguments = @"C:\TonysTemp\TMT1.txt C:\TonysTemp\TMT2.txt";
process.Start();
StreamReader reader = process.StandardOutput;
process.WaitForExit(10000);
string line = reader.ReadToEnd();
process.Close();
I'm fairly new to programming and would appreciate any help.
Thanks
|
|
|
|
|
 hey there, here's an app i did something similar with...
its a console app that calls "sqlCmd" to run my data base scrips, the output of each of the sqlCmd programs is dispalyed on the calling program.
Hope this helps
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Threading;
using System.IO;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.Smo.Wmi;
using Microsoft.SqlServer.Management.Common;
namespace CreateDB
{
public class Program
{
public static string database;
public static string userName;
public static string password;
static void Main(string[] args)
{
getVariables();
FileStream fs = new FileStream(@"C:\scripts.txt", FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader(fs);
killDatabase();
string line = sr.ReadLine();
while (line != null)
{
ProcessStartInfo StartInfo = new ProcessStartInfo("sqlcmd", "-S " + database + " -d master" + " -U " + userName + " -P " + password + " -i " + line);
Process myProcess = new Process();
StartInfo.UseShellExecute = false;
StartInfo.RedirectStandardOutput = true;
myProcess.StartInfo = StartInfo;
myProcess.Start();
Console.Write("Started Process --> ");
myProcess.WaitForExit();
StreamReader outputReader = myProcess.StandardOutput;
Console.WriteLine("Finnished Process ---> output:" + "\r\n");
Console.WriteLine(outputReader.ReadToEnd());
Console.WriteLine();
Console.WriteLine("|------------------------------------------------------------------------------|");
Console.WriteLine();
line = sr.ReadLine();
}
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine("DDDD OOOO N N EEEEEE ");
Console.WriteLine("D D O O NN N E ");
Console.WriteLine("D D O O N N N EEE ");
Console.WriteLine("D D O O N N N EEE ");
Console.WriteLine("D D O O N NN E ");
Console.WriteLine("DDDD OOOO N N EEEEEE ");
Console.ResetColor();
Console.Read();
}
private static void getVariables()
{
Console.Write("Please Enter DataBase Name: ---> ");
database = Console.ReadLine();
Console.Write("User Name ---------------------> ");
userName = Console.ReadLine();
Console.Write("Password ----------------------> ");
password = Console.ReadLine();
Console.Clear();
}
private static void killDatabase()
{
try
{
Server srv = new Server(database);
srv.KillDatabase("uniclox_db");
}
catch (Exception ex)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine(ex.Message);
Console.ResetColor();
}
}
}
}
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
Hello,
VS 2008
Our client wants to have a phone dialer application. So they want to have different buttons with different shapes and colours. To make it look more like a telephone dialer. They don't want to have the normal button look that are dragged on to the form.
Is there any free third party controls that have the look and feel of different buttons.
Is it possible to create these buttons yourself? Any good links to be able to do this?
Many thanks,
Steve
|
|
|
|
|
You may create a custom button class that is inherited from the button class. Then define your own paint method and draw button the way you want. You should look into GDI stuff for colouring and speicall effects. There are may ariticles on CP.
|
|
|
|
|
In my windows form I am creating 1000 objects when a button is clicked and am not disposing those obects, just to check how much memory this act is taking through the Windows Task Manager.
What I want to know that, is there any way I could figure out which class instianting or taking more memory. I tried attaching my application with the windows CLR Profiler but it's hell like complicated and it shows me so many internal classes that I freak out and to be honest don't know which area to look into. Any best suggestion would help me. Thanks
|
|
|
|
|
Actually, Windows CLR Profiler is a really good free tool for this task, if not the best free tool.
What you basically do is the following:
- Start your app from CLR profiler
- Close your app
- In the summary window go to "allocation graph" (as an example)
- In the new window you can search for a specific method using the menu "Edit" -> "Find Routine". You could enter your button click handler here
- The graph will jump to the routine you searched for, in case the routine is found
- You can doubleclick on the rectangle representing your method to focus only on this method, and from your you'll have a better overview of the routine in question
hope this helps
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Wow, never seen that CLR profiler before. That is a great tool. Thanks.
Simon
|
|
|
|
|
hi guys, I am almost desperate about this, I was trying for whole day, I want to set the initial direcotory for OpenFileDialog on FTP folder. How I can do that please help me. If someone knows some example it will be great to share with me. Thx Ahead
|
|
|
|
|
Hi,
I have a custom class wich contains a string property calles FilePath.
When I use this class in my PropertyGrid I want to be able to fill the FilePath with help of a File Dialog.
How do I do this??
|
|
|
|
|
|
This would be perfect if i could get it to work .
But the problem is my "System.Windows.Forms.Design" doesn't contain a "FileNameEditor".
I'm I still doing something wrong?
Extra info.
I'm working with the .net 3.5 framework.
modified on Friday, June 27, 2008 3:15 AM
|
|
|
|
|
I've allready found it.
You have to add the System.Design.dll as a reference.
Thanks.
|
|
|
|
|
=========================================================================================
MailMessage msgMail = newMailMessage("ngoc_kha@gmail.com", "ngoc_kha@yahoo.com");
msgMail.Subject = (" Công Ty Ð?i Nam Kính Chào Quý Khách");
msgMail.Body = ("hi?n nay công ty chúng t?i dang ");
SmtpClient s = newSmtpClient();
s.Host = "smtp.gmail.com";
NetworkCredential basicAuthenticationInfo = newNetworkCredential("ngoc_kha@gmail.com", "ttth1278");
s.UseDefaultCredentials = false;
s.Credentials = basicAuthenticationInfo;
s.EnableSsl = true;
s.Send(msgMail);
================================================================================
error
"The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required."
are you help me??? sorry my english isn't well
|
|
|
|
|
I am sure someone wrote an article to do that, right here in CodeProject. Just search for "gmail SMTP".
|
|
|
|
|
Hi,
I am tryiing to update one of the settings inside the app.config file.
This is the code I am trying to run. No error is produced by nothing gets updated. I think the problem is to do with appsettings because the code does not find appSettings inside the app.config
Any thoughts please?
public static void WriteSetting(string key, string value)
{
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings.Add(key, value);
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings");
}
---------------
app.Config file data:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="DataAccess.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<applicationSettings>
<DataAccess.Properties.Settings>
<setting name="MailTo" serializeAs="String">
<value>myMailAddress</value>
</setting>
<setting name="Folder" serializeAs="String">
<value>C:\Work\Developments</value>
</setting>
<setting name="Filter" serializeAs="String">
<value>*.*</value>
</setting>
<setting name="EnableMonitor" serializeAs="String">
<value>True</value>
</setting>
<setting name="MailServer" serializeAs="String">
<value>smtpinternalMailServer</value>
</setting>
<setting name="MailFrom" serializeAs="String">
<value>myMailAddress</value>
</setting>
</DataAccess.Properties.Settings>
</applicationSettings>
</configuration>
|
|
|
|
|
|
Is it possible to see what the problem is in the code already posted please?
Thanks
|
|
|
|