|
Thanks, you helped me find my issue. All of my various usercontrols inhereted a definition for a .Save() method that would call endedit, but in one of them I set flags to mark a "last modified date" field, that was giving me false positives if I was just trying to check. EndEdit() was the end solution though. Thanks.
|
|
|
|
|
I've got a TreeView and I've got nodes. Everything works fine, except the images I try to use for the nodes come out a little weird. I was expecting to have to play with the original image size, but no matter what I do the images appear a little weird (some parts fuzzy, some parts thick, some parts a little off from original color).
The original images are bitmaps, and I'm just loading them into an imagelist for the TreeView to use.
What's wrong with this picture? Why do other people's treenode images look crisp, clear, and cool, and mine look like they got smudged a little? What am I missing?
-Daniel
Typing too fast fro my owngood
|
|
|
|
|
I noticed that with several controls in VS 2005 (status bar for one). I've never seen it happen in 2003. I'd like to know too if somebody has an answer.
Try code model generation tools at BoneSoft.com.
|
|
|
|
|
This is a continuation of my previous post which Josh was helping me with.
I have the following code:
private void BindData()<br />
{<br />
strPartNumberInputReference = txtSearchPart.Text;<br />
ds = new DataSet();<br />
ds=SqlHelper.ExecuteDataset(this.connectionString, "dbo.GetPartInfo", param);<br />
Session["ds"]=ds;<br />
dt = ds.Tables[0];<br />
Session["dt"]=dt;<br />
dgParts.DataSource=dt;<br />
dgParts.DataBind();<br />
txtSearchPart.Text = "";<br />
<br />
}
I am using the Microsoft SQLHelp.cs class. When it tries to fill the dataset I get the error "Object must implement IConvertible." The code is getting stuck in:
public static DataSet ExecuteDataset(SqlConnection connection, CommandType commandType, string commandText, params SqlParameter[] commandParameters)<br />
{<br />
SqlCommand cmd = new SqlCommand();<br />
PrepareCommand(cmd, connection, (SqlTransaction)null, commandType, commandText, commandParameters);<br />
SqlDataAdapter da = new SqlDataAdapter(cmd);<br />
DataSet ds = new DataSet();<br />
da.Fill(ds); <br />
cmd.Parameters.Clear();<br />
<br />
return ds
I have tried the debugger (which I have little experience) and found that was the line it doesn't like. I've been trying to find some online resources but have not come any further in trying to figure out why I'm getting this error.
|
|
|
|
|
see if this[^] works. He is saying to use the overloaded ExecuteDataset() that specifies a command type.
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?" Colin Angus Mackay in the C# forum
led mike
|
|
|
|
|
Any takers? I need to do an automated form based post where I will post to another .aspx page over a secure https url. In the form post will be 9 fields of data that are text and one which is a binary file.
A NameValueCollection works like a charm for just the text input fields, but I can not seem to include the file which needs to be a binary format. The NameValueCollection expects a string value for the key pairs. I have examined what .Net provides as far as UploadData, UploadFile and UploadValues. I am using UploadValues because of the NameValueCollection.
Any suggestions on how to post everything at one time? Thanks in advance.
My code is:
int FileLen = this.Filepath.PostedFile.ContentLength;
byte[] FileBinaryData = new byte[FileLen];
HttpPostedFile theFile = this.Filepath.PostedFile;
theFile.InputStream.Read(FileBinaryData, 0,FileLen);
NameValueCollection theCollection = new NameValueCollection();
theCollection.Add("ID", "someid"); -- these values will all be suppiled.
theCollection.Add("PWORD","somepwd");
theCollection.Add("PID", "sometextvalue");
theCollection.Add("FOLDER", "sometextvalue");
theCollection.Add("FILE001", theFile); --this needs to be the binary value
theCollection.Add("TYPE1","sometextvalue");
theCollection.Add("FILE002", "");
theCollection.Add("TYPE2","");
theCollection.Add("INVOICE_NUM", "");
theCollection.Add("TOTAL_FEE","");
string url = ConfigurationSettings.AppSettings["PostingURL"].ToString();
WebClient theRequest = new WebClient();
System.Net.NetworkCredential thecred = new NetworkCredential(ConfigurationSettings.AppSettings["NTLogin"].ToString(), ConfigurationSettings.AppSettings["NTPassword"].ToString(), ConfigurationSettings.AppSettings["Domain"].ToString());
theRequest.Credentials = thecred;
byte[] responseArray = theRequest.UploadValues(url,"POST",theCollection);
string m_ResultText = Encoding.ASCII.GetString(responseArray);
return m_ResultText;
GG
-- modified at 12:02 Wednesday 16th August, 2006
GG
|
|
|
|
|
anybody can write the equivalent code for the following without generic:
public class SampleClass<T, U, V> where T : V { }
thank you in advance.
IT makes life crazy!
|
|
|
|
|
No. Generics introduces a new type of programming; one which is not possible without it. You cannot express that line of code in non-generic code.
Josh
|
|
|
|
|
Thanks Josh.
That line of code is really cool with Generic, but it confuses me. Could you explain something that help me to better understand it?
Albert
IT makes life crazy!
|
|
|
|
|
torontomouse wrote: Could you explain something that help me to better understand it?
Such as?
|
|
|
|
|
First, when you post code, surround it with <pre> tags. This will preserve the formatting and distiguishing it from the rest of your text, making it easier to read.
Second, this is a C# programming forum, not a C programming forum. For questions regarding the C language, move this to the appropriate forum.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Goof around music jam with my brothers (with video)
The apostle Paul, modernly speaking: Epistles of Paul
Judah Himango
|
|
|
|
|
I'm trying to make a mdi child window apear always in the back so any other windows to be on top ... can anyone help me?
modified 30-Nov-21 21:01pm.
|
|
|
|
|
hi,
i make a search button and bind data with textboxes, everything is fine, now i make a clear button which will remove textboxes data after when i finished search into the database using search button i use "Clear()" method for all text boxes but now when i press clear button it clears all data in the textboxes but PostalCode and Year is not unbinding the database(not refreshing/clearing). how i can prevent it. remember i'm using two different buttons. and i know the textbox1.DataBindings.Remove()method so plz give me another choice to remove binding from these two fields.
thx
m.reehanmunir
|
|
|
|
|
To remove all databindings from a control you can simply call control.DataBindings.Clear().
You might need to set the Textbox's Text to String.Empty to clear it though.
"Democracy is two wolves and a sheep voting on what to have for dinner" - Ross
Edbert
Sydney, Australia
|
|
|
|
|
<code>
Hi
Tools: C#, .NET 1.1 and Biztalk 2004
I want to execute a policy rule which gets fired based on some input xml and database facts. I am able to pass the input xml facts but how to I pass the database facts information before executing policy. Basically, by passing "Role" information, I want to get "Salary" values which are stored in a database table.
Following is the code snippet:
--------------------------------------------------------------
Input XML:
<ns0:EmpInfo xmlns:ns0="http://EmployeeInfo.EmpInfo">
<Emp>
<Salary></Salary>
<Role>Manager</Role>
</Emp>
<Emp>
<Salary></Salary>
<Role>CIO</Role>
</Emp>
</ns0:EmpInfo>
--------------------------------------------------------------
----------------------------
public string Execute(string sRequestXML, out string sResponseXML, out string sErrorMsg)
{
sResponseXML = string.Empty;
sErrorMsg = string.Empty;
DebugTrackingInterceptor dti = new DebugTrackingInterceptor(@"C:\Biztalk\projects\EmployeeInfo\XSDs\jit.txt");
//create an instance of the XML object
XmlDocument xd1 = new XmlDocument();
xd1.Load(@"C:\Biztalk\projects\EmployeeInfo\XSDs\Copy of EmpInfo_output.xml");
TypedXmlDocument doc1 = new TypedXmlDocument("EmpInfo",xd1);
// create the array of short-term facts
object[] shortTermFacts = new object[1];
shortTermFacts[0] = doc1;
Policy policy = null;
// now execute to see what happens
try
{
//Console.WriteLine("Grabbing the policy ...");
policy = new Policy("EmpInfo");
policy.Execute(shortTermFacts, dti);
FileInfo finfo = new FileInfo(@"C:\Biztalk\projects\EmployeeInfo\XSDs\ProcessedRFP.xml");
StreamWriter writer = finfo.CreateText();
writer.Write(doc1.Document.OuterXml);
writer.Close();
}
catch (Exception ex)
{
FileInfo finfoError = new FileInfo(@"C:\Biztalk\projects\EmployeeInfo\XSDs\Error.xml");
StreamWriter writerError = finfoError.CreateText();
writerError.Write(ex.Message);
writerError.Close();
}
dti.CloseTraceFile ();
policy = null;
return "PASS";
}
</code>
|
|
|
|
|
Hello,
Can anyone help me to find out a tool which will create Dump .SQL file from a SQL Express 2005 .MDF file ? I developed my projects with SQL Express 2005 in my PC and Now I want to deploy in remote Hosting where remote sql server doesn't allow remote connection so I can use any sql manager type software to transfer data.
Thanks and regards
EMRAN
|
|
|
|
|
|
My title probably doesn't quite explain my problem. I found some code for a fully editable grid. It was pointing to the Northwind database, pulling employee information. Okay, no problem. So now I am trying to update the code to fit what I need and I'm getting an error that I can't seem to fix.
Here is the ORIGINAL BindData code:
private void BindData()<br />
{<br />
ds = new DataSet();<br />
ds= SqlHelper.ExecuteDataset(this.connectionString, "dbo.GetEmployees", null);<br />
Session["ds"]=ds;<br />
dt = ds.Tables[0];<br />
Session["dt"]=dt;<br />
DataGrid1.DataSource=dt;<br />
DataGrid1.DataBind();<br />
<br />
}
This code uses a Microsoft SQLHelper.cs class.
Okay, so I created a stored proc called GetPartInfo. Basically there is a text box the user enters a part number, clicks a button and then the grid populates. Based on help from a couple of expert members from CodeProject this what I used to have...
private void BindData2()<br />
{<br />
strPartNumberInputReference = txtPartNumberInput.Text;<br />
string SQLString = "SELECT c.cost, ct.Description AS ctDescription, p.PartNumber, pt.description, dd.DrawingNumber, dd.DrawingRevision, dd.DwgPath FROM costs c INNER JOIN Parts p ON c.PartID = p.Id INNER JOIN PartTypes pt on pt.ID = p.PartTypeID LEFT JOIN DraftingData dd on dd.PartID = p.ID LEFT JOIN CostTypes ct on ct.Id = c.CostTypeId WHERE p.PartNumber = @PartID"; <br />
<br />
SqlCommand cmd = new SqlCommand();<br />
cmd.Connection = new SqlConnection(strConnectSQL);<br />
cmd.CommandText = SQLString;<br />
cmd.Parameters.Add ("@PartID", strPartNumberInputReference);<br />
SqlDataAdapter adapter = new SqlDataAdapter(cmd);<br />
adapter.Fill(ds);<br />
<br />
<br />
dgParts2.DataSource = ds;<br />
dgParts2.DataBind();<br />
txtPartNumberInput.Text = "";<br />
<br />
<br />
}
As you can see I am passing @PartID.
So in my stored procedure I have...
CREATE PROCEDURE [dbo].[GetPartInfo]<br />
@PartID int AS<br />
SELECT c.cost, ct.Description AS ctDescription, p.PartNumber, pt.description, dd.DrawingNumber, dd.DrawingRevision, dd.DwgPath<br />
FROM costs c INNER JOIN Parts p ON c.PartID = p.Id <br />
INNER JOIN PartTypes pt on pt.ID = p.PartTypeID <br />
LEFT JOIN DraftingData dd on dd.PartID = p.ID LEFT JOIN CostTypes ct on ct.Id = c.CostTypeId <br />
WHERE p.PartNumber = @PartID;<br />
GO
Still trying to pass @PartID.
When I tried changing the line...
ds= SqlHelper.ExecuteDataset(this.connectionString, "dbo.GetEmployees", null); to
ds= SqlHelper.ExecuteDataset(this.connectionString, "dbo.GetPartInfo", ("@PartID"));
I get the error that my Input string was not in correct format.
Here is the code for ExecuteDataset:
public static DataSet ExecuteDataset(string connectionString, CommandType commandType, string commandText, params SqlParameter[] commandParameters)<br />
{<br />
using (SqlConnection cn = new SqlConnection(connectionString))<br />
{<br />
cn.Open();<br />
<br />
return ExecuteDataset(cn, commandType, commandText, commandParameters);<br />
}<br />
}
I've tried a bunch of different things and I still get the error. How do I fix this?
Thanks again for all those who help me on this board. Sucks being a newbie.
|
|
|
|
|
I don't see any place where you are setting the actual value for @PartID. I'm not familar with the SqlHelper class but it seems as though you should be passing the value for PartID rather than the name of the paramater name
ds= SqlHelper.ExecuteDataset(this.connectionString, "dbo.GetPartInfo", ( txtPartNumberInput.Text));
|
|
|
|
|
Originally this is how I set @PartID
private void BindData2()<br />
{<br />
strPartNumberInputReference = txtPartNumberInput.Text;<br />
string SQLString = "SELECT c.cost, ct.Description AS ctDescription, p.PartNumber, pt.description, dd.DrawingNumber, dd.DrawingRevision, dd.DwgPath FROM costs c INNER JOIN Parts p ON c.PartID = p.Id INNER JOIN PartTypes pt on pt.ID = p.PartTypeID LEFT JOIN DraftingData dd on dd.PartID = p.ID LEFT JOIN CostTypes ct on ct.Id = c.CostTypeId WHERE p.PartNumber = @PartID"; <br />
<br />
SqlCommand cmd = new SqlCommand();<br />
cmd.Connection = new SqlConnection(strConnectSQL);<br />
cmd.CommandText = SQLString;<br />
cmd.Parameters.Add ("@PartID", strPartNumberInputReference);<br />
SqlDataAdapter adapter = new SqlDataAdapter(cmd);<br />
adapter.Fill(ds);<br />
<br />
<br />
dgParts2.DataSource = ds;<br />
dgParts2.DataBind();<br />
txtPartNumberInput.Text = "";<br />
<br />
<br />
}
I was taking the text from the textbox, and passing it that way. BTW, tried what you wrote but still got the same error.
Oh, the SQLHelper class gave this in the comments:
So I tried that changing my code to:
DataSet ds=ExecuteDataset (connString, CommandType.StoredProcedure, "GetPartID", new SqlParameter ("@PartID"));
But SqlParameter isn't recognized.
-- modified at 15:29 Wednesday 21st June, 2006
|
|
|
|
|
I suspect that this line should be modified
cmd.Parameters.Add ("@PartID", strPartNumberInputReference);
to
cmd.Parameters.Add ("@PartID",sqldbtype.Varchar);
cmd.Parameters["@PartID"].Value = strPartNumberInputReference;
Please tell if that helped
|
|
|
|
|
The saga continues.
Your post is a bit misleading. Your call to ExecuteDataset looks like this:
ds= SqlHelper.ExecuteDataset(this.connectionString, "dbo.GetPartInfo", "@PartID");
But the method signature looks like this:
public static DataSet ExecuteDataset(string connectionString, CommandType commandType, string commandText, params SqlParameter[] commandParameters)
You are not calling the method whose signature you displayed. Notice that you are not passing a CommandType value. If you were to pass CommandType.StoredProcedure, that might help. But, a more immediate error/oversight is that you are not actually passing SqlParameter objects! Your "@PartID" argument is a string, not an SqlParameter object. You need to create a new SqlParameter and pass it the "@PartID" value as it's name. Pass that object into the ExecuteDataset method.
Josh
|
|
|
|
|
Josh, thank you so much for you ongoing (!) help. I've not worked with SQLParameters before. Do you know of a good article or can you give me another push?
|
|
|
|
|
What is it that you need to know? You can create one like this:
SqlParameter param = new SqlParameter( "@PartID", partIDValue );
and then just pass it into a method like any other variable.
Josh
|
|
|
|
|
Then why does it still hate this?
private void BindData()<br />
{<br />
strPartNumberInputReference = txtSearchPart.Text;<br />
ds = new DataSet();<br />
SqlParameter param = new SqlParameter("@PartID", strPartNumberInputReference); <br />
ds=SqlHelper.ExecuteDataset(this.connectionString, "dbo.GetPartInfo", "@PartID");<br />
Session["ds"]=ds;<br />
dt = ds.Tables[0];<br />
Session["dt"]=dt;<br />
dgParts.DataSource=dt;<br />
dgParts.DataBind();<br />
txtSearchPart.Text = "";<br />
<br />
}
|
|
|
|
|