|
hi
how can i fix this problem in my connection string ?
LocalConnection = new SqlConnection("data source=localhost;database=Alarms;Integrated Security=True");
it will fixed when i substitute "localhost" with ".\\sqlexpress"
i want to work with sqlServer 2005 not sqlexpress
the error is:
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.
(provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
|
|
|
|
|
check this http://www.connectionstrings.com/[^]
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
Use
\\ComputerName\SQL2005ServerName insteed of localhost
|
|
|
|
|
hi
how can i call a static method declared in Form1 from business_logic layer
i can call business_logic layer methods from Form1 because :
-------------------form1------------------
using business_logic
------------------------------------
but cannot see form1 methods from business_logic layer because :
----------------- business_logic layer ------------------------
using form1 //does not allowed because of circular dependency
-----------------------------------------------
so what can i do ?
|
|
|
|
|
Take the slightly longer way around, inside business_logic use myNamespace.form1.myMethod
My current favourite word is: Nipple!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
i want to add a new line to a text box.
txtstate.multiline = true
txtstate.text+= "\n";
or
txtstate.appendtext("\n");
doesn't work. all he texts are displayed in the same line.
|
|
|
|
|
Use –
"\r\n"
This should give you a new line.
-Dave.
------------------------------------
http://www.componentone.com
------------------------------------
|
|
|
|
|
you need to use \r\n (carriage return and newline)
|
|
|
|
|
|
Environment.NewLine
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
I searched and found out that in VC++ 2008 can use this
textBox1.Text = "Line One";
textBox1.Text += Environment::NewLine;
textBox1.Text += "Line Two";
Hope it help you!
|
|
|
|
|
I have this table (with the price for sending a letter to different countries):
WEIGHT Denmark Europe Other Countries
---------------------------------------------
50 g | 6,00 10,50 13,50
100 g | 8,25 15,00 21,00
250 g | 13,50 24,00 36,50
500 g | 22,50 40,00 59,00
1000 g | 30,00 66,00 100,00
I need to be able to type which country i want to send a letter to in a console, 1 = Denmark for instance. Then specify the weight of the letter, 120 for instance, and then the program will output 13,50.
What is the best way to deal with this if i also want to be able to edit, delete or add prices, weigthts and countries? Normally i would create a database dealing with this, but i'm trying to figure out some more advanced List<>'s in C#. A hint would be great so i could figure out the rest myself. I've tried to figure out how to automatically assign id's to custom classes when added to a List<>, but i can't seem to find a solution. Is it even the right way to do this?
|
|
|
|
|
Jan Sommer wrote: Is it even the right way to do this?
Arguably no. You had the right idea to start with - a database is for this sort of thing.
However, if this is just an excercise in understanding generic List's then you just create a class which holds the relevant data, store it in a list, and serialize that list to the filesystem for the purpose of storage.
|
|
|
|
|
Well the program doesn't have to save the data on the filesystem, it should only be stored in memory.. i could ofcourse use your method and delete the file afterwords..
but how do i relate the price to weight and country? i'm pretty lost on that part. i can't relate them through their index, because if a weight or country gets deleted, then i'm in trouble.
EDIT: and it's kind of stupid to assign id's myself.. there -must- be a way to do it automatically ??
modified on Monday, September 15, 2008 5:12 AM
|
|
|
|
|
Which part of your data is most constant? Once you've decided that you should build your classes around that.
For example - if the weights will rarely change, but you are likely to be adding and removing countries then I'd go for something like...
public class WeightCollection : List<Weight>
{
}
public struct Weight
{
public Weight(int grammes, List<CountryCost> costs)
{
}
}
public struct CountryCost
{
public CountryCost(string country, decimal cost)
{
}
}
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
Thanks!
i'll see if i can figure it out. Is a struct the way to go with this, and why not use a class?
|
|
|
|
|
It doesn't really make any difference, classes are easier to deal with though.
I tend to use structs for all my values (structs are value types) and classes for the final objects that use those values. I personally find this makes more sense, but unless you're 100% sure you're handling value types correctly - use classes.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Expect everything to be hard and then enjoy the things that come easy. (code-frog)
|
|
|
|
|
lb_MSNo is linkbutton in the Machine Warranty Formview.
Why the servicing_details formview still didn't appear?
[^]
protected void lb_MSNo_Click(object sender, EventArgs e)
{
OdbcCommand cmd; OdbcDataReader reader;
//OdbcConnection connection = WebConfigurationManager.GetConnectionObject();
OdbcConnection connection = new OdbcConnection();connection.ConnectionString = WebConfigurationManager.ConnectionStrings["TamiConnectionString"].ConnectionString;
try
{
LinkButton a = (LinkButton)FV_ResultsS.FindControl("lb_MSNo");
string mw = "SELECT job_id FROM machine_warranty, warranty_period, job WHERE machine_warranty.machine_warranty_id= warranty_period.machine_warranty_id and Machine_SerialNo=" + a.Text + " and job.machine_warranty_id = Machine_Warranty.Machine_Warranty_ID AND machine_warranty.machine_warranty_id=job.machine_warranty_id";
connection.Open();
using (cmd = new OdbcCommand(mw, connection))
{
reader = cmd.ExecuteReader();
while (reader.Read())
{
mw = reader.GetInt32(0).ToString();
}
}
connection.Close();
ds_ServinMW.SelectCommand = "SELECT servicing_id, job.job_id, job_status, job_type, job_no, date_format(Date_Serviced,'%Y-%m-%d') as date_serviced, date_format(date_job_issued,'%Y-%m-%d') as date_job_issued, remarks FROM job, servicing_details, machine_warranty WHERE servicing_details.job_id=job.job_id and job.machine_warranty_id=Machine_Warranty.Machine_Warranty_ID AND job.job_id = "+ mw;
ds_ServinMW.DataBind();
}
catch
{ }
finally
{
connection.Dispose();
}
string test = ds_ServinMW.SelectCommand;
FV_servinMW.DataBind();
FV_servinMW.Visible = true;
}
}
|
|
|
|
|
try putting your code in pre tags, else most of us wont even read it
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
you.suck = (you.passion != Programming)
|
|
|
|
|
Hi all,
can any one guide me on ways to implement the this feature.
In textbox when ever we type some characters , all the entries mathcing to the entered charcters(from database) appear below the text box and user can select ne of the given entry.
|
|
|
|
|
Every string has an IndexOf method to find index of a particular word or character.
So you can search for index of a string in a text box like this –
textBox1.Text.IndexOf("FindThisWord", 0);
-Dave.
------------------------------------
http://www.componentone.com
------------------------------------
|
|
|
|
|
I want a application with OPENGL functionality that too developed in c#.net.
Please give the me some ideas regarding the enviroment setup, dll's required etc.
|
|
|
|
|
You may want to check out the Tao Framework[^], it's a OpenGL wrapper for .NET.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I know that the Graphics class cannot take indexed images (I dont really know why). So I need to convert the indexed image to a color image, then convert it back to indexed image.
How would I go about doing this conversion into color then back into indexed? Would there be data loss during the conversions?
When i was doing it using Photoshop, every time i switched between indexed and RGB, the image got darker and darker, which meant data wasn't being preserved.
|
|
|
|
|
gigahertz205 wrote: I know that the Graphics class cannot take indexed images
Are you sure?
Indexed to RGB shouldn't cause any visible change.
RGB to indexed may cause a change, since a best-fit color table
needs to be created.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|