|
datatable dt=new datatable();
"dt" is having some values.
i wnat to sort these values using dataview....
can anyone help me
|
|
|
|
|
//Assume that my column to sort is "Id"
//Temp is my datatable
DataView dv = new DataView(Temp, null, "Id", DataViewRowState.CurrentRows);
GridView1.DataSource = dv;
GridView1.DataBind();
|
|
|
|
|
Hi Experts
i am using SQL Server 2005 and VS 2005
i Have Database in SQL Server 2005 in My db 120 tables ,35 SP,s ,30 Function i want to create whole database at run time using C#.NET.pls suggest me how many possiable solutions are and How To Create it.
tell me the example if possiable.
Thank u
Dinesh
|
|
|
|
|
Sharma Dinesh Kumar wrote: Database in SQL Server 2005 in My db 120 tables ,35 SP,s ,30 Function
Doesn't really matter in this case, what is the structure of your database.
Sharma Dinesh Kumar wrote: How To Create it
Have a look here at MSDN[^]. This only creates database, but you can enhance it further to execute your whole script.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
there are too many ways to do it, if you wish to use Linq to Sql Classes (.Net3.5), you simply create database with dbObject.CreateDatabase(); method call. or you can generate the create script with Sql Management Studio and then execute it with a sqlconnection object, otherwise there is tool named SQL_Packager[^] it makes these generating scripts and writing codes to execute it steps with simple wizarded UI.
|
|
|
|
|
|
i need help, suppose i have aspx page and inside aspx page one gridview,one dropdownlist and one print button.I have fill gridview onselectindexchanged event of dropdownlist.i want to take print of gridview on client side as well as datasave in database when i click on print button
sudhir kumar
|
|
|
|
|
Do not repost same question.
|
|
|
|
|
Make the "print" button a submit, when you click on it you submit form to page that stores this data in database, and then you redirect to a page which will re-render all this informaiton in gridview and call over JavaScript page print command which is called this way: window.print()
Maybe someone else has better suggestion, you could submit data over "AJAX", but, it's same thing, anyhow he need to submit this data, only if you would save it over ajax you would save some time re-rendering gridview.
|
|
|
|
|
Could you not find the ASP.NET forum ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
Hi guys ....
I've been writ a simple program using sockets to send data from client to server
here is my program
server code
<pre>
public class SocketListener
{
public static string data = null;
public static void StartListening()
{
byte[] bytes = new Byte[1024];
IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName());
IPAddress ipAddress = ipHostInfo.AddressList[0];
IPEndPoint localEndPoint = new IPEndPoint(ipAddress, 11000);
Socket listener = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
try
{
listener.Bind(localEndPoint);
listener.Listen(10);
while (true)
{
Console.WriteLine("Waiting for a connection...");
Socket handler = listener.Accept();
data = null;
while (true)
{
bytes = new byte[1024];
int bytesRec = handler.Receive(bytes);
data += Encoding.ASCII.GetString(bytes, 0, bytesRec);
if (data.IndexOf("< My 1st socket prog >") > -1)
{
break;
}
}
Console.WriteLine("Text received : {0}", data);
byte[] msg = Encoding.ASCII.GetBytes(data);
handler.Send(msg);
handler.Shutdown(SocketShutdown.Both);
handler.Close();
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
Console.WriteLine("\nPress ENTER to continue...");
Console.Read();
}
public static int Main(String[] args)
{
StartListening();
return 0;
}
}
</pre>
and client code
<pre>using System;
public class SocketClient
{
public static void StartClient() {
byte[] bytes = new byte[1024];
try {
IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName());
IPAddress ipAddress = ipHostInfo.AddressList[0];
IPEndPoint remoteEP = new IPEndPoint(ipAddress,11000);
Socket sender = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp );
try {
sender.Connect(remoteEP);
Console.WriteLine("Socket connected to {0}",
sender.RemoteEndPoint.ToString());
byte[] msg = Encoding.ASCII.GetBytes("This is a test< My 1st socket prog >");
int bytesSent = sender.Send(msg);
int bytesRec = sender.Receive(bytes);
Console.WriteLine("Echoed test = {0}",
Encoding.ASCII.GetString(bytes,0,bytesRec));
sender.Shutdown(SocketShutdown.Both);
sender.Close();
} catch (ArgumentNullException ane) {
Console.WriteLine("ArgumentNullException : {0}",ane.ToString());
} catch (SocketException se) {
Console.WriteLine("SocketException : {0}",se.ToString());
} catch (Exception e) {
Console.WriteLine("Unexpected exception : {0}", e.ToString());
}
} catch (Exception e) {
Console.WriteLine( e.ToString());
}
}
public static int Main(String[] args)
{
StartClient();
return 0;
}
}</pre>
now I want to let 1st client "producer" generates random message and sends it to the server, then server checks the buffer, if there is enough space to store it, then it stores it, otherwise it neglects the message
and 2nd client "consumer" will be connected to the server and asks the server for data, the server in turn will check the buffer. If the buffer is empty then the consumer will wait
that's all and thank u
|
|
|
|
|
My application is having two listboxes.
first listbox is getting values from database
double click on first listbox value will remove from first listbox and add to second listbox.i completed this.
but my problem is double click on second listbox value should remove from second listbox and add to first list box and i already mentioned that first listbox is getting value from database.
|
|
|
|
|
Well, isn't it the same thing, but in the other direction ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
private void firstlistbox_DoubleClick(object sender, EventArgs e)
{
if (firstlistbox.Items.Count > 0 && firstlistbox.SelectedItems.Count > 0)
{
secondlistbox.Items.Add(lst_ApplicantGroups.Text);
dtCompanyForm.Rows.RemoveAt(firstlistbox.SelectedIndex);
firstlistbox.DataSource = dtCompanyForm;
//lst_ApplicantGroups.Items.Remove(lst_ApplicantGroups.Text);
}
}
//Above code is working fine
//but secondlistbox_doubleclick is not working.
//can anyone help me
private void secondlistbox_DoubleClick(object sender, EventArgs e)
{
if (secondlistbox.Items.Count > 0 && secondlistbox.SelectedItems.Count > 0)
{
string currentItemText = secondlistbox.SelectedItem.ToString();
int currentItemIndex = secondlistbox.SelectedIndex;
dtCompanyForm.Rows.Add(currentItemText);
secondlistbox.Items.RemoveAt(lstSelected.Items.IndexOf(lstSelected.SelectedItem));
firstlistbox.DataSource = dtCompanyForm;
}
|
|
|
|
|
What does 'does not work' mean ? What did you find was happening when you use the debugger ?
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
What is that "debugger" think you are talking about?
|
|
|
|
|
On MouseDoubleClick event of second listbox, add clicked item to the datasource of the first listbox.
|
|
|
|
|
private void firstlistbox_DoubleClick(object sender, EventArgs e)
{
if (firstlistbox.Items.Count > 0 && firstlistbox.SelectedItems.Count > 0)
{
secondlistbox.Items.Add(lst_ApplicantGroups.Text);
dtCompanyForm.Rows.RemoveAt(firstlistbox.SelectedIndex);
firstlistbox.DataSource = dtCompanyForm;
//lst_ApplicantGroups.Items.Remove(lst_ApplicantGroups.Text);
}
}
//Above code is working fine
//but secondlistbox_doubleclick is not working.
//can anyone help me
private void secondlistbox_DoubleClick(object sender, EventArgs e)
{
if (secondlistbox.Items.Count > 0 && secondlistbox.SelectedItems.Count > 0)
{
string currentItemText = secondlistbox.SelectedItem.ToString();
int currentItemIndex = secondlistbox.SelectedIndex;
dtCompanyForm.Rows.Add(currentItemText);
secondlistbox.Items.RemoveAt(lstSelected.Items.IndexOf(lstSelected.SelectedItem));
firstlistbox.DataSource = dtCompanyForm;
}
|
|
|
|
|
Same code works fine for me. Check that the event is fired and code within if block is getting executed on double click.
|
|
|
|
|
"Input string was not in a correct format.Couldn't store <we> in ID Column. Expected type is Int64." error is coming in dtCompanyForm.Rows.Add(currentItemText); line
|
|
|
|
|
It is clear enough. You are trying to add string value to integer column.
|
|
|
|
|
Hi,
ya i have done.
in first listbox double click-->i created one more datatable for second list box and i added removed row from first listbox to that datatable and i binded that datatable to second listbox.
in second listbox double click event just i did in reverse.
anyway iam thankful to u r help
|
|
|
|
|
|
Ok
i will do like that.
thank you
|
|
|
|
|
try this:
public void MoveItems(ListControl lbName1, ListControl lbName2)
{
for (int i = 0; i < lbName1.Items.Count; i++)
{
if (lbName1.Items[i].Selected == true)
{
ListItem li = new ListItem();
li.Text = lbName1.SelectedItem.Text;
li.Value = lbName1.SelectedItem.Value;
lbName2.Items.Add(li);
lbName1.Items.Remove(li);
i--;
}
}
}
protected void firstlistbox_SelectedIndexChanged(object sender, EventArgs e)
{
MoveItems(firstlistbox, secondlistbox);
}
protected void secondlistbox_SelectedIndexChanged(object sender, EventArgs e)
{
MoveItems(secondlistbox, firstlistbox);
}
|
|
|
|