|
I'm trying to insert a record into a sql server 2000 database using a store
procedure (vs.net is my develop tool) on the button click event but I keep
getting the following error after clicking the button:
Object must implement IConvertible.
When i try to read TemplateColumns from datagrid and to insert in sql server table, i think is the problem.
I don't have any trace.
Code:
public void inscriereemail()
{
string conn = ConfigurationSettings.AppSettings["conn"];
SqlConnection objConnection = new SqlConnection(conn);
SqlCommand mycmd = new SqlCommand("add_email", objConnection);
mycmd.CommandType = CommandType.StoredProcedure;
lblint.Text = Request.QueryString["id"];
SqlParameter expeditorp=new SqlParameter ("@expeditor", SqlDbType.VarChar, 4);
expeditorp.Direction=ParameterDirection.Input;
expeditorp.Value= lbluser.Text;
mycmd.Parameters.Add(expeditorp);
SqlParameter destinatar1p=new SqlParameter ("@destinatar", SqlDbType.VarChar, 5);
destinatar1p.Direction=ParameterDirection.Input;
destinatar1p.Value = dgdest.Items[0].FindControl("lbldest"); <- Problemns
mycmd.Parameters.Add(destinatar1p);
SqlParameter destinatarp=new SqlParameter ("@destinatar_camion", SqlDbType.VarChar, 4);
destinatarp.Direction=ParameterDirection.Input;
destinatarp.Value= lblint.Text;
mycmd.Parameters.Add(destinatarp);
SqlParameter titlup=new SqlParameter ("@titlu", SqlDbType.VarChar, 25);
titlup.Direction=ParameterDirection.Input;
titlup.Value=txttitlu.Text;
mycmd.Parameters.Add(titlup);
SqlParameter mesajp=new SqlParameter ("@mesaj", SqlDbType.VarChar, 800);
mesajp.Direction=ParameterDirection.Input;
mesajp.Value=txtmesaj.Text;
mycmd.Parameters.Add(mesajp);
SqlParameter cititp=new SqlParameter ("@citit", SqlDbType.VarChar, 1);
cititp.Direction=ParameterDirection.Input;
cititp.Value = "1";
mycmd.Parameters.Add(cititp);
SqlParameter trashp=new SqlParameter ("@trash", SqlDbType.VarChar, 1);
trashp.Direction=ParameterDirection.Input;
trashp.Value = "1";
mycmd.Parameters.Add(trashp);
SqlParameter data_adaugarep=new SqlParameter ("@data_adaugare", SqlDbType.VarChar, 35);
data_adaugarep.Direction=ParameterDirection.Input;
data_adaugarep.Value = lblTime.Text;
mycmd.Parameters.Add(data_adaugarep);
try
{
objConnection.Open();
mycmd.ExecuteNonQuery();
}
finally
{
if (objConnection.State == ConnectionState.Open)
{
objConnection.Close();
}
}
}
|
|
|
|
|
ujupanmester wrote: destinatar1p.Value = dgdest.Items[0].FindControl("lbldest"); <- Problemns
destinatar1p.Value = ((Label)dgdest.Items[0].FindControl("lbldest")).Text;
|
|
|
|
|
Thanks.
Your code work fine and thanks a lot because you help me.
|
|
|
|
|
hi all
i have 2 com+ is A AND B
i want if client can call B have to after call A
if client call B will have Exception
Ex:
if client call A
after call A will return for client
C = New B
return C
Client call
B b = C
---------------
if Client call
B b = new B;
will Exception
-- modified at 6:35 Saturday 24th June, 2006
|
|
|
|
|
Please post it to COM forum.
Best,
Jun
|
|
|
|
|
Hi everyone,
______ 1 _______
| |<----------->| |
| | 2 | |
|______|<----------->|_______|
Client machine Web Service
Webmethod 1 and Webmethod 2 are being called here.
I want to make both happened in a single transaction.i.e "1" also should rollback if "2" has failed.
I can't open a connection object in the client.Its been opened in the webservice.
1
|<----------> [webmethod A (Transaction) ]
client app | 2
|<----------> [webmethod B (Transaction) ]
Here after 1 the transaction will be over in normal scenarios ,which should not happen
How do I achieve this.
Thanks in advance
-- modified at 14:13 Saturday 24th June, 2006
|
|
|
|
|
if I drag an Outlook.MailItem to a Windows-Explorer window a
<subject>.msg file will be created.
Now I try to drag & drop a mail item to my own WinForm app.
Unfortunately it doesn't work.
Any ideas?
|
|
|
|
|
Standard question #1:
What do you mean by "not working"?
You have to enable drag-and-drop for the controls in your form that should recieve them. Then you implement the events that handles it.
---
b { font-weight: normal; }
|
|
|
|
|
When I drag a mail from outlook to MSWord an attachment will displyed in MSWord. I need the same thing in C# application.
Thanks
Ramana
|
|
|
|
|
Sometimes it feels like someone replying to a post of mine didn't read my post at all. This is one of those times.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa wrote: You have to enable drag-and-drop for the controls in your form that should recieve them. Then you implement the events that handles it.
So, in your C# application, set the necessary control to handle the drag-in-drop.
|
|
|
|
|
|
Hi,
I want to dynamically load some assemblies and invoke certain functions given in those assemblies. All these functions will implement the same interface, so that I don't have to bear the performance hit of a Type.InvokeMember call. For loading these assemblies dynamically I will, obviously, have to use the Assembly.Load/LoadFrom routines.
My question is, is it advisable to put some assemblies (which may be dynamically loaded frequently) into the GAC or have some sort of a replacement algorithm (like LRU) to add and remove these assemblies from the GAC ? Also, if I put these assemblies into the GAC, will the Assembly.Load/LoadFrom routines check the GAC first while searching for the assembly or will I have to query the GAC to find whether the requested assembly exists in the GAC or not and then proceed?
Thanks for any thoughts or help.
Cheers
|
|
|
|
|
How to sort contents of datatable using one or more columns and assign the sorted contents to Data Grid.
Jey
|
|
|
|
|
You need to use DataView[^] class to sort the contents of a DataTable.
And then use the DataView as the DataSource to your DataGrid.
Michael
CP Blog [^] Development Blog [^]
-- modified at 6:57 Saturday 24th June, 2006
|
|
|
|
|
Thanks Michel, It's working. Can i assign the sorted content to the same data table.
Jey
|
|
|
|
|
How to sort contents of datatable using one or more columns.
Jey
|
|
|
|
|
+I have applicaton, i write on PocketPC 2002 Emulator, but :
+ When i press F5 , my application not show on Pocket PC, i must go to directory of my application and run it. but i can't debug my App.
+ But i press Ctrl + F5 , my application show on Pocket PC, but i can't debug my app
+ And it show Message :
Error while trying to run project: Unable to start debugging. + Pocket PC Emulator
+ I'm using VS2003, FW1.1
Help! Thanks
Please send mail to : thp_1981@yahoo.com
doremon
-- modified at 8:44 Saturday 24th June, 2006
|
|
|
|
|
sorry if this is a repost
Unlike web forms where we could set the datasource property of the combobox alias dropdownlist to the datareader and then set value member and display member .
we cannot do this directly in web forms
we need to do a loop and add the members
ComboBox1.Items.Clear()
If (dr !=null)
{
while (dr.Read())
{
ComboBox1.Items.Add(dr["Name"]);
}
}
how should we add for value members and display members if binding is through the datareader and not dataset
|
|
|
|
|
I found the solution for it myself , hope this could be usefull to someone
this is the code snippet for it , it needs a supporting class along with it
private void button1_Click(object sender, System.EventArgs e)
{
OleDbConnection dbconn = new OleDbConnection(@"Provider=microsoft.jet.oledb.4.0;data source=D:\ashishg\TEST.mdb");
OleDbCommand dbcmd = new OleDbCommand("Select idTest,NameTest from tbltest",dbconn);
OleDbDataReader reader;
dbconn.Open();
reader = dbcmd.ExecuteReader();
ArrayList temptbl = new ArrayList();
while (reader.Read())
{
temptbl.Add(new NameValue(reader["NameTest"].ToString(),reader["idTest"].ToString()));
}
dbconn.Close();
comboBox1.DataSource = temptbl;
comboBox1.DisplayMember = "NameMember";
comboBox1.ValueMember = "ValueMember";
}
the supporting class
public class NameValue
{
private string myNameMember;
private string myValueMember;
public NameValue(string strNameMember,string strValueMember)
{
this.myNameMember = strNameMember;
this.myValueMember = strValueMember;
}
public string NameMember
{
get
{
return myNameMember;
}
}
public string ValueMember
{
get
{
return myValueMember;
}
}
}
The Secret of gettting ahead is getting started
|
|
|
|
|
i want to run my c# project in a pc where visual studio.net is not setup.
how can i do it.
|
|
|
|
|
hi
install the framework on that pc , then install your project
on it
Tamimi - Code
|
|
|
|
|
thanks, but size is matter.that is very big.i want small size.
|
|
|
|
|
it is a web application ??
Tamimi - Code
|
|
|
|
|