|
What is your code for make connection,where did u get problem
|
|
|
|
|
Hi nidhi ,
im sending u code for connectivey. plz tell me whr is the prob . i want to submit all the data in databse when i click on button . i define web.config .but prob is not solved.
public partial class _Default : System.Web.UI.Page
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString);
SqlCommand cmd = new SqlCommand();
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
conn.Open();
cmd.Connection = con;
cmd.CommandText = "insert into guest values(@Name ,@email ,@location,@Message)";
}
|
|
|
|
|
Could you pls send me web.config code also,one more thing is there have u debug ur code,i think when u'll click on button it will not go to your this event:
protected void Button1_Click(object sender, EventArgs e)
{
conn.Open();
cmd.Connection = con;
cmd.CommandText = "insert into guest values(@Name ,@email ,@location,@Message)";
}
pls debug ur code and then let me know that ur debugger is going to this event or not.
|
|
|
|
|
no nidhi this is not the prob. it goes to that event. i m sending u my web.config file
<configuration>
<appsettings>
<connectionstrings>
<add name=" cn" connectionstring="server=192.168.0.4/ver2005;database=test_jasjit;uid=jasjit;pwd=jasjit;">
<system.web>
<compilation debug="true">
<authentication mode="Windows">
|
|
|
|
|
You r trying to fetching connectino from web.config using this code
:
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString);
but you have not define connection in web.config.
please write this code in your web.config and update :you sql server name,
your database name,userid for accessing database,password for accessing database
<connectionStrings>
<add name="cn" connectionString="Data Source=you sql server name;Initial Catalog=your database name;User ID=userid for accessing database;pwd=password for accessing database;Max Pool Size = 8000; Pooling = true;"
providerName="System.Data.SqlClient " />
</connectionStrings>
|
|
|
|
|
Hello fellow developers,
I am currently using .NET 3.5, C#...
I have searched the forums and google for a match on this one and no one seems to hit the mark. I have found close answers, but they are just missing one aspect. So here goes:
Simple question:
How can I set an Image to a FileUpload stream without first saving that Stream to a file or a DB?
Read below for more "Background info"
I am currently using a FileUpload control to allow the user to upload an image to be attached to a "Profile". I want the user to be able to preview that image before they save the form and it gets streamed to the DB and stored. Basically, once they hit the upload button, I want that Stream from the FileUpload control to be "Loaded" into the Image Control. I want to do this all without writing to disk as a temporary preview image and then pointing to that url... I just don't like that solution.
Currently I just save the image to the DB with the Profile data and then use an HTTP Handler file to read the image data I saved and stream it back to the image using image property ( IE: ImageURL="DisplayImage.ashx?id=133" ) which works great.
I tried to store the image data in a session variable, but then found out that the session data is not available to my HTTP handler DisplayImage.ashx, although the context.Session is there in Intellisense and in the debugger, but it is null, so the Session from the page calling it is not available.
I will gladly post any code requests if you need more information on what I am doing.
Kind Regards,
Ryan
|
|
|
|
|
well, looks like I posted this just a bit soon, my next researching effort netted me the solution.
I simply had my HttpHandler inherit the System.Web.SessionState.IRequiresSessionState interface and the Session was available for me to use.
public class DisplayImage : IHttpHandler, IRequiresSessionState {
Regards,
Ryan
|
|
|
|
|
I see many site have for each user own libary
ex: www.somedomain.com/users/newUser
My question is how can i do that? how can i create for each user
his/her own libary not using IIS ofcourse because
what if i'd have 10000 users...
than x
|
|
|
|
|
|
Adding to the other reply,
You can also use ASP.NET MVC which will produce URLs like what you said. But it is still in beta
|
|
|
|
|
Hey Navaneeth Congrats For MVP !!!
cheers,
Abhijit
|
|
|
|
|
That was unexpected. Congratulations to you too!
|
|
|
|
|
N a v a n e e t h wrote: That was unexpected.
Not At All !!!.
cheers,
Abhijit
|
|
|
|
|
Congrats...
N a v a n e e t h wrote: That was unexpected
I don't think so. Because after CG it was you and abhijit who were very regular in asp.net forum. A well deserved for both of you.
Apurva Kaushal
|
|
|
|
|
Much appreciated. Many thanks
|
|
|
|
|
Thanks Apurva.
cheers,
Abhijit
CodeProject.Com MVP
|
|
|
|
|
Hi
Can i bound TreeView Node Editor with my custom server control if yes the how can i change it properties
Thanks
|
|
|
|
|
Does anyone have any suggestions for a good, web based math equation editor? Ideally it would be pure .net, but I'm open to flah or java if required.
Any suggestions would be appreciated
|
|
|
|
|
Hi ,
I have created one image using graphics and saved in the stream.
the code is given below.
what i need is, i have to set the image to the imagebox in the application, the image box is not having and option to set the image? how to do that?
public void test(string strText)
{
Response.Clear();
Random r = new Random();
int height = 156;
int width = 535, x = r.Next(75), i = 0, j = 0, k = 50;
string[] strName = new string[20];
for (i = 0; i < strText.Length; i++)
{
strName[i] = strText.ToString().Trim().Substring(i, 1);
}
Bitmap bmp = new Bitmap(width, height, PixelFormat.Format64bppPArgb);
Graphics g = Graphics.FromImage(bmp);
g.TextRenderingHint = TextRenderingHint.AntiAlias;
g.Clear(Color.White);
for (i = 0; i < strText.Length; i++)
{
if (j == 0)
{
SolidBrush brush = new SolidBrush(Color.FromArgb(255, 00, 00));
g.DrawString(strText.ToString().Trim().Substring(i, 1), new Font("Trebuchet MS", 50, FontStyle.Italic), brush, new PointF(k, 10));
}
else if (j == 1)
{
SolidBrush brush = new SolidBrush(Color.FromArgb(00, 255, 00));
g.DrawString(strText.ToString().Trim().Substring(i, 1), new Font("Trebuchet MS", 50, FontStyle.Italic), brush, new PointF(k, 10));
}
else if (j == 2)
{
SolidBrush brush = new SolidBrush(Color.FromArgb(00, 00, 255));
g.DrawString(strText.ToString().Trim().Substring(i, 1), new Font("Trebuchet MS", 50, FontStyle.Italic), brush, new PointF(k, 10));
}
else if (j == 3)
{
SolidBrush brush = new SolidBrush(Color.FromArgb(255, 00, 255));
g.DrawString(strText.ToString().Trim().Substring(i, 1), new Font("Trebuchet MS", 50, FontStyle.Italic), brush, new PointF(k, 10));
}
j++;
if (j > 3)
j = 0;
k = k + 40;
}
bmp.Save(Response.OutputStream, ImageFormat.Jpeg);
g.Dispose();
bmp.Dispose();
Response.End();
}
|
|
|
|
|
The typical way is to either create a bitmap in the file system and use the URL to load it in, or you create a page that your image control points to, and it takes a query string parameter to stream back the bitmap.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Mr Christian Graus,
Thanks for your response.
actually my requirement is to load that image to the image box that is kept on the particular position on the asp.net page.
the coding gives me the image in the separate page.
i want to have that image in my image box.
How to do that?
|
|
|
|
|
Hi All,
I need code or way so I can insert any text or number into textbox and convert it to barcode format. any help plz
Regards
|
|
|
|
|
|
I already do this, but no result found !
thanks for help !
|
|
|
|
|
|