|
Hello everyone,
What is the function of "D10" when use it as input parameter to Int.ToString? For example, someIntValue.ToString ("D10")? I can not find any document about this format input parameter from MSDN. Any documents?
thanks in advance,
George
|
|
|
|
|
|
Great Phillip!
I found the answer and the function is padding.
regards,
George
|
|
|
|
|
or:
int value = -16325;
Console.WriteLine("D10: {0:D10}", value);
|
|
|
|
|
Hi All,
i am having this code in c#:
if (type.IsSubclassOf(typeof(SqlDataAdapter)))
{
//doing sth here
}
what i am trying to do with this code is: when the "type" object returns "TableAdapter", the if statement will returns "true" and does certain process. however, when the "type" object does return "spClientSearch_Husband_WifeTableAdapter", but the whole if statement returns false hence it doesn't do the sth that i need the code to do.
can someone tell me is there anything wrong with it?
most appreciated.
Andie
|
|
|
|
|
I'm guessing you have an object and are trying to determine whether or not it's a DataAdapter by first getting its type.
But you don't provide all the code. The simpler solution is to use the is or as operator:
public void Fis ( object o )
{
if ( o is SqlDataAdapter ) ...
}
public void Fas ( object o )
{
SqlDataAdapter s = o as SqlDataAdapter ;
if ( s != null ) ...
}
|
|
|
|
|
Thanks a lot PIEBALDconsult, i had worked out another approach so this problem has been fixed.
|
|
|
|
|
I doubt it's better than is or as .
Care to show your solution?
|
|
|
|
|
First check to see whether "spClientSearch_Husband_WifeTableAdapter" is really a subclass of "SqlDataAdapter" or not.
Judge a man by his questions rather than his answers. - Voltaire
Blogial
|
|
|
|
|
Thanks a lot Blogial, i had worked out another approach so this problem has been fixed.
|
|
|
|
|
Is there a way to use a font with C# without installing it. I'm using C# to write headers into images so i can use different fonts for headers on my website but my web host does not have the font installed that i want. Given that i can't install it is there a way to use it without installing it?
|
|
|
|
|
Look at System.Drawing.Text.PrivateFontCollection .
|
|
|
|
|
I've never been able to get that class to work properly
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios
Discounted or Free Software for Students:
DreamSpark - downloads.channel8.msdn.com
MSDN Academic Alliance - www.msdnaa.com
|
|
|
|
|
Hi
How Can I store images and retrive them to Data Grid View in database ??

|
|
|
|
|
There's two questions here, both easy to answer using articles on this site, or through google.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
I assume that your questions are; "how i can store images in sql and display in C#".
1) you can´t display images in the gridview, but you don´t need it any way! just trigger your store procedure and display string, int or date data in the gridview and display the images in a picturebox .
2) if you want to know more in how to store images in sql just type "sql image store (whatever)" in search article, and you will get some answers! Theres good articles about it. It´s not hard.
Good Luck
|
|
|
|
|
create a folder in your application folder and store images into that instead of storing them into database, in your database store that image's URL.Now to retrieve them in gridview control bind the gridview's column using Eval method.
for example
in between <asp:gridview xmlns:asp="#unknown">....
<asp:image runat="server" id="myimage" imageurl="<%#Eval(" your="" image="" url="" ")#%>"="" xmlns:asp="#unknown">
use all those formatting like columns and itemtemplates and all the stuff this is just a clue,so obviously a bit messy but if u don't understand ask anything... 
|
|
|
|
|
Hi,
I have 'SQL Server 2000' on 'Windows Server 2003'.
From my application that installed on another computer (with windows XP), I want to connect to my DB (on first computer) but this error appears :
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections
I don't installed SQL Server 2005 at all!
Best wishes
|
|
|
|
|
mehrdadc48 wrote: my application that installed on another computer (with windows XP)
Are you sure that machines doesn't have SQL Server 2005 or SQL 2005 Express installed on it?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hi,
Double-check your connection string. This error message is generic and doesn't mean that you are actually trying to connect to SQL Server 2005. It only tells that the server defined in your connection string cannot be found.
Some possible reasons:
- wrong server name / ip-address
- no instance name defined if no default instance at server side
- no port defined if the standard port (1433) is not used on server and so on
Hope this helps,
Mika
|
|
|
|
|
Hi Everyone
I need to call two methods, (one written in javascript defined in the header part of an aspx page and the second written in c# in aspx.cs file of the same aspx page) in the button_click action of a button in the aspx page. The first method is about to show the user a please wat page, and the second method processes the user input.
And I can not put the first method from within the second one, because of some problems.
Please help me.
|
|
|
|
|
semiramisContraA wrote: I need to call two methods, (one written in javascript defined in the header part of an aspx page and the second written in c# in aspx.cs file of the same aspx page) in the button_click action of a button in the aspx page.
You can't do that. You can't call an existing Javascript function from the server side event.
Use the client side click event (accessible throught the OnClientClick property of the control) to call the Javascript function.
semiramisContraA wrote: And I can not put the first method from within the second one, because of some problems.
Of course not. When the server side event runs, the request for the new page has already started, so the first function doesn't exist any more. If you would add code to the page from the server side event for calling the Javascript function, that code would load when the page is completed, and it would call the new Javascript function that would be created when the page reloads after postback.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
1 - use the ASP.NET forum in future
2 - read an ASP.NET book, you obvioulsy have no idea how it all works
3 - if you want to show a 'please wait' page while the processing occurs, you need to use AJAX, otherwise your page will be blank if you are using IE.
Christian Graus
No longer a Microsoft MVP, but still happy to answer your questions.
|
|
|
|
|
Hi, i got a database created in ms access 2003. Inside the database, there are 6 tables and a few relationship.
I want to link my database to my inventory system.
My inventory system is created based on MDI. When the application is loaded, the login form is begin created
childLogin = new FrmLogin();
childLogin.ShowDialog(this);
if (childLogin.DialogResult == DialogResult.OK)
{
stripLblLoginAs.Text = "Login As : " + childLogin.Username;
}
I have added a existing datafile to my project (ebms.mdb). I also created a DatabaseManager.cs to check the connection
public class DatabaseManager
{
public OleDbConnection connection;
public OleDbDataAdapter dataAdapter;
public DataSet dataSet;
public string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=ebms.mdb";
public bool GetDataConnection()
{
try
{
connection = new OleDbConnection(connectionString);
dataAdapter = new OleDbDataAdapter("select * from staff", connectionString);
dataSet = new DataSet();
dataAdapter.Fill(dataSet, "Staff");
return true;
}
catch (Exception ex)
{
MessageBox.Show("Error : " + ex.Message);
return false;
}
}
}
Now, inside my FrmMain, i have created a new object of this DatabaseManager
public partial class FrmMain : Form
{
DatabaseManager dbm = new DatabaseManager();
And inside my form_load i have check the connection
if (this.dbm.GetDataConnection())
{
MessageBox.Show("Connection Established");
}
else
{
MessageBox.Show("Connection Failed");
}
Now, the problem is how do i validate the username and password entered in childLogin with my staff table inside my database..
|
|
|
|
|
benjamin yap wrote: the problem is how do i validate the username and password
Query against your table that holds the login. If it comes back with an empty dataset, then login has failed, otherwise login worked.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|