|
I have just helped - what I described are fairly fundamental features of the C# language, so you if you don't understand that, I'd suggest you find yourself a good book on the subject
|
|
|
|
|
select the datagrid and right click it a pop up menu will displayed inside that u will find Choose Data Source inside that u give the database name and the table name it will automatically displays the datas that are binded inside the table on the page load itself....
|
|
|
|
|
hi,
i have got a class like this in my windows form project.I wanna change ranges horizantalaligment to left?
class ExcelAktar
{
private Excel.Application Excelim;
private Excel.Workbook CalismaKitabi;
private Excel.Worksheet CalismaSayfasi;
public void OkuVeYaz(DataGridView DisDataGrid, string CalismaSayfasiIsmi)
{
//DisDataGrid.AllowUserToAddRows = false;
Excelim = new Excel.ApplicationClass();
object SalakObje = System.Reflection.Missing.Value;
CalismaKitabi = Excelim.Workbooks.Add(SalakObje);
CalismaSayfasi = (Excel.Worksheet)CalismaKitabi.ActiveSheet;
CalismaSayfasi.Name = CalismaSayfasiIsmi;
int SutunIndex = 1;
int SatirIndex = 2;
// Sütunlar Yazılıyor.
foreach (DataGridViewColumn Sutun in DisDataGrid.Columns)
{
CalismaSayfasi.Cells[1, SutunIndex] = Sutun.HeaderText;
SutunIndex++;
}
// Satırlar Yazılıyor.
foreach (DataGridViewRow Satir in DisDataGrid.Rows)
{
for (int ci = 0; ci < DisDataGrid.Columns.Count; ci++)
{
CalismaSayfasi.Cells[SatirIndex, ci + 1] = Satir.Cells[ci].Value.ToString();
}
SatirIndex++;
}
// Excel gösteriliyor
Excelim.Visible = true;
// Biçimlendirme
CalismaSayfasi.get_Range("A1", "J1").EntireColumn.AutoFit();
CalismaSayfasi.get_Range("A1", "J1").Font.Bold = true;
CalismaSayfasi.get_Range("A1", "J1").EntireColumn.Font.Size= 7;
CalismaSayfasi.get_Range("A1", "J1").HorizontalAlignment = 2;
CalismaSayfasi.get_Range("A1", "J1").RowHeight = 16;
|
|
|
|
|
Hi,
how to make the generic type has specific constructor?
what should I add on the class definition if I don't want to add get/set function to set that value for some reason?
e.g.
public class ClassA<T>
{
public T Create()
{
List list = outside.list();
T t = new T(list);
}
}
// how to let T is only has a T(List list)? I have thing about Interface and Abstract class but those cannot work. And if I tried to use another class to input the value, it's too specific. any solution?
Thanks.
|
|
|
|
|
Hi all,
How can I achieve the same pop out like window, that Visual Studio 2005 uses.
Can anyone please provide me some information whether this is possible or not.
Many Thanks
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Iam having an HTML file where in iam writing some text and it has some background image embedded in it.i want to convert that html file to image file and want to export it in pdf format.(without converting to image file,the image is not exported.)can anyone tell me how to convert an html image file into pdf format using c# coding.it is very urgent.please
pintoo
|
|
|
|
|
|
chithra.r wrote: it is very urgent.please
Please don't say this. It's rude. Besides, it can't be that urgent otherwise you would be paying someone for assistance, right?
There's nothing built into the .NET framework for creating PDF files. You will have to use a third-party component. Search the web for more information.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hi,
I've got a query which looks similar to this: "...FROM xy WHERE ID=@Id AND NAME IN (@Names)". I want to pass multiple parameters for @Names, so that it would be like:
"...AND NAME IN ('Susi', 'Peter', 'Steven')"
Is this anyhow possible with the use of parameters? Is could form a qry like that in the code with building up the string, but I would prefer the way with parameters.
The problem is that when I setup @Names to be AnsiString or String (Varchar) then it builds something like this: N'Susi, Peter, Steven'. That's one long String so it searches in the DB like the following: "... NAME IN('Susi, Peter, Steven') - which of course, doesn't exist.
Any ideas? Impossible?
Thx, Shi
|
|
|
|
|
TheShihan wrote: I've got a query which looks similar to this: "...FROM xy WHERE ID=@Id AND NAME IN (@Names)". I want to pass multiple parameters for @Names, so that it would be like:
"...AND NAME IN ('Susi', 'Peter', 'Steven')"
Don't know exactly, try this
FROM xy WHERE ID=@Id AND NAME IN (@Name1,@Name2,@Name3) add parameters for all these.
|
|
|
|
|
the problem is, that you don't know in advance, how many parameters are passed. It's dynamic.
|
|
|
|
|
TheShihan wrote: I've got a query which looks similar to this: "...FROM xy WHERE ID=@Id AND NAME IN (@Names)".
I don't think you can do this.
One way you could do this without dynamically constructing a SQL statement to execute is to split your comma-separated list and load the items into a table variable. You can then JOIN your table xy to your table variable to find the records in this table where the name is in the list.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
TheShihan wrote: to pass multiple parameters for @Names
Something like this[^]
Once you have mastered the ability to turn yourself invisible at will, and to deflect bullets with your hair, you will be ready to come back here to the lounge and post programming questions.Only at this point will you be able to dodge the fireballs that are going to come your way. - Pete O'Hanlon
|
|
|
|
|
ho to add right-click to a "Console" object ?
thanks
|
|
|
|
|
You cant.
xacc.ideIronScheme a R5RS-compliant Scheme on the DLR
The rule of three: "The first time you notice something that might repeat, don't generalize it. The second time the situation occurs, develop in a similar fashion -- possibly even copy/paste -- but don't generalize yet. On the third time, look to generalize the approach."
|
|
|
|
|
Why on Earth would you want something like that?
I will use Google before asking dumb questions
|
|
|
|
|
|
hi,
I have fetched two database tables "MTQABenchMarks" and "Users" in the datagridview. This is a windows application. Now I have to update the "MTQABenchMark" database after making changes to the datatable present in the application. When I run the code it is throwing an exception "Dynamic SQL generation is not supported against multiple base tables." How to solve this. the code is
public Form1()
{
InitializeComponent();
}
static SqlConnection Con = new SqlConnection("Data Source= 192.168.100.234; Initial Catalog=gishyd; User ID=sa; password=gis*2005");
SqlDataAdapter Da = new SqlDataAdapter("SELECT dbo.Users.UserID, dbo.MTQABenchMark.Id as EmpID, dbo.Users.FirstName + ' ' + dbo.Users.LastName AS Name, dbo.MTQABenchMark.NoofMinPerDay,dbo.MTQABenchMark.PerMonth FROM dbo.Users INNER JOIN dbo.MTQABenchMark ON dbo.Users.UserID = dbo.MTQABenchMark.EID ", Con);
DataSet Ds = new DataSet();
private void Form1_Load(object sender, EventArgs e)
{
Da.Fill(Ds, "MTQABenchMark");
dataGridView1.DataSource = Ds.Tables["MTQABenchMark"];
}
private void button2_Click(object sender, EventArgs e)
{
SqlCommandBuilder CmdBld = new SqlCommandBuilder(Da);
Da.InsertCommand = CmdBld.GetInsertCommand();
Da.Update(Ds, "MTQABenchMark");
MessageBox.Show(" Database is Updated");
}
}
}
Nitin Raj Bidkikar
|
|
|
|
|
Select query can be run against multiple tables, while Update query can be run only one table. In your application you select data from 2 tables, and store it in a dataset. When you try to update the database you use the same dataset. It's not possible, because the application tries to update 2 tables at the same time. You should do a separate update for each table, with values from your dataset.
Hope it helps.
I will use Google before asking dumb questions
|
|
|
|
|
how do you suggest to do that
Nitin Raj Bidkikar
|
|
|
|
|
Split the dataset into 2 datasets or datatables that contain fields from only one table, and then use these to update the database.
I will use Google before asking dumb questions
|
|
|
|
|
I won't write the code for you...try to do something and if you get stuck...post a question with your problem.
I will use Google before asking dumb questions
|
|
|
|
|
Hi,
I got a problem that I would like to return a generic object in a non-generic object, what can I do?
I searched a lot of page but it's talking about how to use or implement a generic class, but if I want to implement a normal class and return a generic object according parameter, what can I do?
e.g.
class DaoFactory
{
Dao<T, IdT> GetDao(Type t)
{
//something like this.
//how to implement?
}
}
Thanks
Jr. P
calendarw
|
|
|
|
|
How about this one?
/// <summary>
/// Convert an ArrayList from a derived type to the base type
/// </summary>
/// <typeparam name="S">Derived type</typeparam>
/// <typeparam name="D">Base type</typeparam>
/// <param name="list">The ArrayList</param>
/// <returns>An ArrayList containing elements converted to the base type</returns>
public static List<D> Transform<S, D>(List<S> list) where S : D
{
List<D> lst = new List<D>();
foreach (S element in list)
lst.Add(element);
return lst;
}
I will use Google before asking dumb questions
|
|
|
|
|
Thank you.
I changed to this:
public static List<D> Transform<D>(System.Collections.IList list)
{
List<D> lst = new List<D>();
foreach (D element in list)
lst.Add(element);
return lst;
}
Actually, I tried to search using google but I don't know what keyword should be used for this case.
|
|
|
|