|
Because the table name is the one you added in the dataset:
DataTable table999;
string command = "select * from Table1";
SqlDataAdapter father = new SqlDataAdapter(command, myConnection);
DataSet son = new DataSet();
son.Tables.Add("Table1");
father.Fill(son, "Table1");
...
That's work.
But there has only one select statement in your case, why don't you use the index rather than table name?
|
|
|
|
|
how to do that in index? can u pls kindly show your code. thanks
|
|
|
|
|
As I posted before:
this.textbox.text = ds.DataTable[0].Rows[0]["name"].ToString();
|
|
|
|
|
i have to export the data present in a datagridview to excel. Does anyone know how to do it. this is windows application using c#
|
|
|
|
|
|
Hi,
i have a user control windows form.where i use splitter control.
and i drag this user control on another form. i want scrolling on
my user control.for which i have use used splitter control.but
splitter control,do not shows scrolling (splitter control panel2)
so how can i show scrolling in user control, when i drag it in to another form.
amit
|
|
|
|
|
you want to scroll bar show in the panel or your user control??
|
|
|
|
|
i want it in splitter control panel2.which i have used in user control.
amit
|
|
|
|
|
Did you set the panel2.AutoScroll to true? It's default is false
|
|
|
|
|
I want to send video file to multiclients from server using sockets in C# . As using threads I've successfully sent to multiclients but not simultaneously.
If one client sends a request to server for a file, then server starts transmitting it and during that transmission if any other client sends request for file then 1st transmission got prob. and 2nd one also not initiated.
plz help me out how to send file to multiclients simultaneously.
Thanx.
Shanzay
|
|
|
|
|
Hi all i am using Coalesce function in sqlserver 2005 following is sp
ALTER PROCEDURE [dbo].[GetAllBillDetails]
(
@FromDate AS DATETIME,
@ToDate AS DATETIME
)
AS
BEGIN
DECLARE @Err int
SELECT
BillNo,
SalesDate,
CustName,
Address,
Discount,
TotalAmount,
NetPayable
FROM
Sales
WHERE
SalesDate BETWEEN COALESCE(@FromDate,SalesDate)
AND COALESCE(@ToDate,SalesDate)
SET @Err = @@Error
RETURN @Err
END
following is code to in C# to call this sp
private void BindGrid()
{
SqlCommand command = new SqlCommand("GetAllBillDetails", sqlConn);
SqlDataAdapter ada = new SqlDataAdapter();
DataSet dataSet = new DataSet("Master");
ada.TableMappings.Add("Table", "Master");
command.CommandType = CommandType.StoredProcedure;
DateTime? fdate;
DateTime? todate;
fdate = dtpFromDate.Value.Date;
todate = dtpToDate.Value.Date;
if (!dtpFromDate.Checked)
{
fdate = null;
}
if (!dtpToDate.Checked)
{
todate = null;
}
command.Parameters.Add(new SqlParameter("@FromDate", fdate));
command.Parameters.Add(new SqlParameter("@ToDate", todate));
ada.SelectCommand = command;
ada.Fill(dataSet);
}
It is giving me error like procedure or function GetAllBillDetails requires parameter @FromDate which was not supplied.
Can any one help me to solve this issue...
Dipak Thesiya
DRC Pvt Ltd...
dipak
|
|
|
|
|
Try passing System.DBNull.Value rather than just null .
|
|
|
|
|
I'm trying to make a chat server. I can make a server/client connection and use that to chat back and forth between the server and the client.
But I need to be able to have multiple clients and I don't know how to do that at all.
Can someone help me with this? Is there a tutorial for making a chat server in C# somewhere or an example of one I can look at?
|
|
|
|
|
|
Using Plain Socket connection
|
|
|
|
|
Smithakrishnan wrote: But I need to be able to have multiple clients
Your server program should be multi threaded. Are you using a socket connection ? If yes you have to keep all your client objects in an arraylist for further communication. When a new client is connected, create a thread for him and keep it's object in an array list/list.
|
|
|
|
|
Hi All,
Can any one please tell me how to make a grid editable on a keypress.
My exact requirement is I have a Gridview1 which has the edit column and can be updated.
but I have been asked to do it in a keypress for eg. if some press F2 the row should be Editable.
Thanks in Advance
|
|
|
|
|
you can code in keypress event to check for F2 key press and then set the edit mode of your grid
forexample
dataGridView1.EditMode = DataGridViewEditMode.EditOnEnter;
|
|
|
|
|
2 simple way to complete your requirement.
1.) add a menustrip in your application, then add an item and set the shortcut to f2
2.) add a keyboard event handler in your app and detect if key == Key.f2
either way to fire a function to set the gridview tobe edit mode.
|
|
|
|
|
Sorry I forgot to mention that Im in Developing WEB APPLICATION
|
|
|
|
|
you can add a javascript event capture the keypress, if event == f2, then fire the callback and set the gridview as editmode.
FYR.
function dosomething()
{
var key = window.event.keyCode;
alert(key);
}
|
|
|
|
|
Since f2 is a functional key ..can you please tell how to get the keypress value for it
|
|
|
|
|
got it through onkeydown event thank you
|
|
|
|
|
I writing my two object student and campus to a xml file but i am wondering is there a way to create student or campus object directly from the xml file. I mean I want to instiantiate student class if my program reading student data or campus from the xml file.
I couldn't find any simple example
Thanks for ur help in advance
|
|
|
|
|
You should use the XmlSerializer[^] class. The documentation contains examples of its usage.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|