|
Thanks !
But i didnt find the solution. Isn't there anybody to do that !
|
|
|
|
|
You have the solution, it's just that you need to to spend some time modifying it so it suits your specific problem.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
thanks
i dont know the solution .
Help! if possible give example!
|
|
|
|
|
jojoba2011 wrote: i dont know the solution .Help! if possible give example! There is really no point in you repeatedly posting the same cry. I have given you a link to the method you need to use, which includes a code sample which demonstrates exactly how it can be used to expand an environment variable in a string. Unless you give some more details about how exactly you are trying to use it and why it does not work, then it is unlikely that we can guess what your problem is.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hi sir,
this is exactly what i wanna to use in webconfig:
<connectionStrings>
<add name="SqlConnStr" connectionString="Data Source=.\CMSNegin;AttachDbFilename=%ProgramFiles%\CMSNegin\Data\MSSQL10.CMSNegin\MSSQL\DATA\1\NeginDB.mdf;uid=sa;pwd=A@D#F$G%" providerName="System.Data.SqlClient"/>
</connectionStrings>
i dont know which drive is system drive (C or D).cause my setup copies the database to %programfiles% .
may be C:\program files OR D:\Program files.
modified 2-Oct-12 12:51pm.
|
|
|
|
|
I still don't understand what your problem is. If you follow the documentation in the link I gave you[^], it shows exactly how to get the real path from an environment variable, including the system drive. What more do you need?
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I think this is what your looking for.
Your example makes no sense to me, and I don't see the point of it. If your sql server is loaded on your hard drive, why not use the standard connection string?
As far as using a programmable path like %ProgramFiles%, that's a Windows thing, which works in certain scripting languages and the cmd prompt. I don't think the application that reads the web.config file is smart enough to translate %ProgramFiles% to the proper file path, and if it did, you need to see if it adds the final slash to the end of the path.
You still have to code the database name to make it work. Since it's on your hard drive, a trusted connection should work fine.
Server=.\SQLExpress;AttachDbFilename=c:\asd\qwe\mydbfile.mdf;Database=dbname;
Trusted_Connection=Yes;
[Edit]
If you need connection strings, go here
http://www.connectionstrings.com/[^]
Richard, I was talking to the OP, still getting use to the new look and feel.
|
|
|
|
|
jkirkerx wrote: I was talking to the OP And you did it correctly.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hi every one.
I have copying my database via setup to Program File of customer system.
now how can i give the conection string that can attach the DB (in webconfig):
<connectionStrings>
<add name="SqlConnStr" connectionString="Data Source=.\CMSNegin;AttachDbFilename=<code>%programfiles%</code>\TSMS.mdf;Initial Catalog=NeginDB;uid=sa;pwd=u1$%^ggrf0923" providerName="System.Data.SqlClient"/>
</connectionStrings>
I have used "<code>%ProgramFiles%</code>" but no use...
Please Help
Thanks in Advanced !
|
|
|
|
|
hi, i'm developing a asp.net application ,it's concept for open word document using asp.net ,
it's work fine in local when i upload iis it dispay error
like "On the File menu, click Open. Search for the file using this dialog box.(//path)"
|
|
|
|
|
Hi all,
If you know any site providing advanced graphic controls for web development, please suggest.
Controls like AJAX controls, different colored check box, radio option etc..
Thanks a lot in advance!
Vaibhav
|
|
|
|
|
why we have a number of data controls in asp.net (like, repeater, datalist, gridview, form view etc )? What is differnece between form view, list view, and datalist Controls.
|
|
|
|
|
jkmehmi wrote: why we have a number of data controls in asp.net (like, repeater, datalist, gridview, form view etc )?
Because each of them has different use and need. All are important and used for data presentation in form or other.
jkmehmi wrote: What is differnece between form view, list view, and datalist Controls.
Why did you not try to look for it on Google/Bing[^]?
One of the link: http://itmall.blogspot.in/2008/10/what-is-difference-between-gridview.html[^] - In a nutshell, it says:
GridView:
(1)Can select one row to do something.
(3)update, delete records in database, but not insert
(4)Sort, paging
(5)Concurrency handling
(6)Display empty data
(7)Formatting (e.g. alternative row style)
(8)Customize field (e.g. use TemplateField to edit record)
(9)Extend (e.g. create LongTextField for GridView)
ListView:
(1) template driven
(2) can add data to database
(3) can edit, page through, sort database data
(4) ListView is the only control implementing IPageableItemContainer interface, so it is the only one which can use DataPager control.
ListView is the most flexible List control in all. I can safely use ListView in place of GridView.
Repeater:
(1) display database records. It cannot edit/insert records
(2) entirely template driven
DataList:
(1) display database records(can edit?)
(2) entirely template driven
DataList is very similar to Repeater except that DataList's default behavior is rending the content using a table. However, you can override the default behavior.
DetailsView:
(1) Display/edit/delete/Insert records in database
(2) Render a table for a single record. always render each field in a seperate table row.
FormView:
Exactly like DetailsView except that FormView is entirely template driven.
ListControl:
there are RadioButtonList, DropDownList, CheckBoxList, BulletedList, ListBox.
|
|
|
|
|
Thank you sir for giving a quick reply in a brief way. I m new in code project. it was my first query. thanks.
|
|
|
|
|
hi,i wanna start learning asp.net with c# but nowhere can i find a pdf file please aid me,its my humble request.Thanks in advance.
|
|
|
|
|
|
I am struggling converting image to byte array using client side script.
I have to convert image to byte array, and pass this array to web service or Page methods, so that the web services or Page methods can save the image in sql server. Any one please help me
Thanks in advance,
Please help me....
|
|
|
|
|
[edit]
At first I didn't think that was possible. I know javascript can do many things, but to read an image file sounds far fetched.
Apparently, there are many articles about reading a image file as a base64 array of chars. Transmitting it to a web service would be easy, but since it's not a primitive data type like a string or integer, you would have to consume the array in a class first, and then as a primitive type. That's get a bit tricky especially in vb, but there are many c# examples out there that work fine.
I use uploadify with a sub process attached to it. I suppose I'm one step away from being able to complete your task, I just need to do the javascript end, and update my class. and modify a web service for it.
As far as starting from scratch, write the javascript first, and then work on the web service side, and just write the file to the disk drive for testing to make sure the byte array is intact.
[sample link^]
modified 30-Sep-12 17:13pm.
|
|
|
|
|
hi jkirkerx,
Thank you so mush for your reply,
I have tested below code
var p;var canvas = document.createElement("canvas");
var img1=document.createElement("img");
function getBase64Image(){
p=document.getElementById("fileUpload").value;
img1.setAttribute('src', p);
canvas.width = img1.width;
canvas.height = img1.height;
var ctx = canvas.getContext("2d");
ctx.drawImage(img1, 0, 0);
var dataURL = canvas.toDataURL("image/png");alert("from getbase64 function"+dataURL );
return dataURL;
}
My problem is , above logic IE cant support
Any idea plz advise me ...
modified 1-Oct-12 5:04am.
|
|
|
|
|
I ran into that about 2 months ago, IE has it's own set of rules for createElement, while Firefox and others use the standard rules, or in other words, the ones on the mozilla website.
As an example
innerText versus innerHTML
Plus, it's case sensitive, and by the way, sometimes you won't get an error, it will just read the value and do nothing in either browser.
I would have to spend an half hour and run the code to see what's happening, to modify it.
I would run it in IE, and press F12, or use the developer module, and set it to script, and run the page, it will catch the error on the right pane, you click on it, and shows you the source in the left pane, with the cursor on the error and a explanation.
I'll get back to this in about an hour
|
|
|
|
|
I'm not running html5, but while debugging your sample, I ran across this datasheet
http://msdn.microsoft.com/en-us/library/ie/ff975241%28v=vs.85%29.aspx[^]
This is probably a better sample for IE. OK, onLoad you Draw() the image in the canvas, then click the button to get the data that was drawn image.
<!DOCTYPE html><html>
<head>
<script type="text/javascript">
function draw()
{
var canvas = document.getElementById("MyCanvas");
if (canvas.getContext)
{
var ctx = canvas.getContext("2d");
ctx.fillStyle="white";
ctx.beginPath();
ctx.rect (5,5,300,250);
ctx.fill();
ctx.stroke();
ctx.arc(150,150,100,0,Math.PI, false);
ctx.stroke();
}
}
function putImage()
{
var canvas1 = document.getElementById("MyCanvas");
if (canvas1.getContext) {
var ctx = canvas1.getContext("2d");
var myImage = canvas1.toDataURL("image/png");
}
var imageElement = document.getElementById("MyPix");
imageElement.src = myImage;
}
</script>
</head>
<body onload="draw()" bgcolor="lightgray" >
<div>
<button onclick="putImage()">Copy graphic using toDataURL</button>
</div>
<div>
<canvas id="MyCanvas" width="400" height="400" > </canvas>
<img id="MyPix">
</div>
</body>
</html>
|
|
|
|
|
hi jkirkerx
Thank u so mush for your reply, I have used uploadify.js process, Now it working with session inproc mode but , here we have used session stateserver mode so we cannot save httpposted file in session.
What i will do now..plz help me.
|
|
|
|
|
I didn't use the html5 version of uploadify, so I'm not sure how it works.
I had to write a Sub Process module, that mimics a webpage on upload, and I saved the image file on the drive in a temp location, actually a library, in which the image can be retrieved again for reprocessing. The Sub Process Module was session capable, so you can set a value. So my Sub Process uses system.drawing to create 4 images in various sizes, and writes a temp image with a temp name for previewing. Then I wrote a cleanup function that searches for previous temp files by date and time, and deletes the ones that are 1 day old.
Why are you trying to save the byte stream in a session?. You can save it as a byte() array or memory stream, just save the filepath in the session, or are you making it cluster ready?
|
|
|
|
|
private void button3_Click(object sender, EventArgs e)
{
try
{
SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\new.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
con.Open();
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter("select * from master", con);
da.Fill(dt);
DataRow r = dt.NewRow();
SqlCommand cmd = new SqlCommand("insert into master(itemno,itemname,rate,session) values(" + textBox1.Text + ",'" + textBox2.Text + "'," + textBox3.Text + ",'" + textBox4.Text + "')", con);
cmd.ExecuteNonQuery();
r[4] = convertToByte(textBox6.Text);
dt.Rows.Add(r);
SqlCommandBuilder cb = new SqlCommandBuilder(da);
da.Update(dt);
RefreshData();
con.Close();
MessageBox.Show("picture save in the database");
}
catch (Exception ex) { MessageBox.Show(ex.Message); }
}
private void button5_Click(object sender, EventArgs e)
{
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
textBox6.Text = Path.GetFullPath(openFileDialog1.FileName);
pictureBox1.ImageLocation = textBox6.Text;
}
}
byte[] convertToByte(string sourcePath)
{
FileInfo fi = new FileInfo(sourcePath);
long sizeByte = fi.Length;
FileStream fs = new FileStream(sourcePath, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
byte[] data = br.ReadBytes((int)sizeByte);
return data;
}
|
|
|
|
|
hi sarathviper
Thanks for your reply
I need to save file from client side ...
Thanks
Vijay rangs
|
|
|
|
|