|
The Code Is
this.sqlConnection1.Open();
if (sqlCommand1.Parameters.Count == 0)
{
this.sqlCommand1.CommandText = "INSERT INTO tblImgData(ID," +
" Name,Picture) values(@ID,@Name,@Picture)";
this.sqlCommand1.Parameters.Add("@ID",
System.Data.SqlDbType.Int, 4);
this.sqlCommand1.Parameters.Add("@Name",
System.Data.SqlDbType.VarChar, 50);
this.sqlCommand1.Parameters.Add("@Picture",
System.Data.SqlDbType.Image);
}
this.sqlCommand1.Parameters["@ID"].Value = this.editID.Text;
this.sqlCommand1.Parameters["@Name"].Value = this.editName.Text;
this.sqlCommand1.Parameters["@Picture"].Value = this.m_barrImg;
int iresult = this.sqlCommand1.ExecuteNonQuery();
MessageBox.Show(Convert.ToString(iresult));
|
|
|
|
|
Have you set the Connection property of sqlCommand1 ?
this.sqlCommand1.Connection = this.sqlConnection1;
I won’t not use no double negatives.
|
|
|
|
|
Thanks Philip
It Worked...
|
|
|
|
|
Hi all!
i want to fire an event to my application when ever i open or switch to other application.
for example: when i open word document, then the event should fire in my C# application. and when i change word document to another document then i need to get event.
need: i want to clear the clipbord data when the focus goes other than the internet explorer.
pls urgent... can anyone has any idea.
thanks in advance.
|
|
|
|
|
Here is two api GetForegroundWindow and GetWindowText for getting the title of forground window.
GetForegroundWIndow returns integer value. and pass it to GetWindowText.
Best Regard
If you can think then I Can.
|
|
|
|
|
Thanks for the reply.
i have already those two funcation. and i want to use that function while i past.
so my primary need is how to identify the past event.if i get the focus on the past event then i will use GetForegroundWindow and GetWindowText then i will decide whether to past or clear the clipboard.
do u have any idea on that !
thank you
Regards
.....Jack
|
|
|
|
|
you can use it by using hook.
Obvious you are changing application by Mouse or Keyboard.
By using hook u can check it in Keydown or mouse event.
Best Regard
If you can think then I Can.
|
|
|
|
|
Thanks !
if i dont get any other way then i will follow you.
and i too thought of that. but i was expecting some other ways.
Thanks for your idea.hope i will follow that.
thanks
Regards
.....Jack
|
|
|
|
|
ok,Good Luck
If you can think then I Can.
|
|
|
|
|
Hello all
I'm a beginer and I need some help documents.Is there a one that could help me more!!?
Please help me to find one or more.
Thank you.
Regards
Behesht
|
|
|
|
|
I saw the beginners article but I think I need more simpler docs
I don't know any thing about c#!!
and I'm new in dotnet too!(I'm so brave or maybe mad )
no problem I love to know C# and dotnet!!!!
Could you please help me!?
Thank you.
----
Regards
Behesht
|
|
|
|
|
You should use Books or Google.
And use these work practically.
If you can think then I Can.
|
|
|
|
|
A really good book I found was "C# for Dummies". Easily can get hold of via the web or at a book store.
|
|
|
|
|
Helo Every 1,
I want to receive files via MODEM and files are being transferred by XMODEM. I am using C# and want to receive files from different MODEMS.
What is the way to receive and send files by XMODEM using c#? I can do it by Hyper Terminal but I want to do it in my code.
Any Suggestion will be very helpful..
Thanks in advance..
Regards,
-SIFAR.
|
|
|
|
|
|
I have been hunting for over a week to understand xml. I have no Idea why the concept of how to use it alludes me. Sorry in advance. This is a real noob question.
I have built an application that manages the installation and updates several of our packaged products. The problem is All the settings are stored in sql tables.
I just need to understand is:
1)How to create a XML file that stores the connection string
2)How to refer to that XML file to use the connection string in the application.
3)If the file gets deleted, how to have the application recreate a template with a default connection string.
My Application is C#
Any information directly or indirectly would greatly be appreciated. This project needs done by the end of the week. And this is the only part I can not figure out.
mgeorge@peerassistllc.com
modified on Tuesday, June 23, 2009 11:05 PM
|
|
|
|
|
JollyMansArt wrote: 1)How to create a XML file that stores the connection string
2)How to refer to that XML file to use the connection string in the application.
You can use application configuration file (app.config ) for that. It is in XML format. There is a appSettings[^] element where connection strings can be stored. ConfigurationManager.AppSettings gives you access to this element.
|
|
|
|
|
I tried that but I can not seem to get the value to return properly... Here is what I do..
I go to the application project manager,
right click on project
Say properties
Go to the settings tab and put
Name: SQLConnectionString
Type: string
Scope: Application
Value: "Data Source=PA-DEVPLATFORM1\SQL2005;Initial Catalog=AppLoader;Persist Security Info=True;User ID=Mike;Password=zephyr"
This SQLConnection String I am wanting in a external XML file editable to the end user so I do not have to recompile the application for every sql server change.
Here is the code I am using to call it. It does not work.
SqlConnection conn = new SqlConnection(Properties.Settings.Default.SQLConnectionString);
I can not seem to get
ConfigurationSettings.AppSettings
to be identified as a valid command...
I got close by adding
public static NameValueCollection AppSettings { get; }
but the applications says it needs a set added to it.
PLEASE any help on this?
----------------------------------------------------------
So far I have figured out to get the setting I think I need to do this?
SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationSettings.AppSettings["SQLConnectionString"].ToString());
But it still comes back saying the string is null... Why?
modified on Wednesday, June 24, 2009 1:54 AM
|
|
|
|
|
Got it....
string testanswer = PeerAssistLoader.Properties.Settings.Default.SQLConnectionString.ToString(); //["SQLConnectionString"].ToString();
MessageBox.Show(testanswer);
I had the value in the settings with quotes around the connection string. Since I was viewing that field as a string value. Now I know better...
modified on Wednesday, June 24, 2009 2:16 AM
|
|
|
|
|
JollyMansArt wrote: I am wanting in a external XML file editable to the end user
If you want it editable by the end user, I would create my own using XMLDocument - there is a big risk of the user damaging other application settings by mistake if he is encouraged to edit the app.config file directly.
See Here[^] for an example.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
As Navaneeth says above, you probably want to use an app.config file for storing your connection string.
There are two ways of storing the connection string in said file.
The first is quick, dirty and I don't like it, but I'll show you anyway...
The connection string can be stored within the "appSettings" section of your app.config file, as follows:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="MainDB" value="Data Source=127.0.0.1;Initial Catalog=MainDB;User ID=usr;Password=pwd"/>
</appSettings>
</configuration>
To then read this setting from within your c# app, you'd need to use the following code:
System.Configuration.AppSettingsReader reader = new System.Configuration.AppSettingsReader();
string connString = (string)reader.GetValue("MainDB", typeof(string));
The reason I don't like the above method, is because the app.config specification includes a section specifically for connection strings.
Below is an example of an app.config that uses this section:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="MainDB" providerName="System.Data.SqlClient" connectionString="Data Source=127.0.0.1;Initial Catalog=MainDB;User ID=usr;Password=pwd"/>
</connectionStrings>
</configuration>
To then read this section, you first need to add a reference to "System.Configuration " to your project.
Then, you can use the code below:
string s = System.Configuration.ConfigurationManager.ConnectionStrings["MainDB"].ConnectionString;
Much nicer
|
|
|
|
|
|
Hi all,
I am trying to get the following input data using http post .
i have my asp.net Page reading the data as :
if (Request.QueryString["customer_fname"] != null)
fname = Request.QueryString["customer_fname"];
the value of fname is test.However,Its alwyas having a null string.
IS it not getting the http post for the above html?
Can any one advice Please?
Thank you in advance
modified on Tuesday, June 23, 2009 7:10 PM
|
|
|
|
|
Hidden field, use Request.Form instead:
string fname = "";
if (Request.Form["customer_fname"] != null)
{ fname = Request.Form["customer_fname"]; }
Response.Write("fname value: " + fname);
Regards,
Gary
|
|
|
|
|
can someone put a code snip here that i can use to determin if a adusers is disabled
|
|
|
|