TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Guest User
Tech Writer
6
2.5k
load file address??
May 30 2011 5:47 PM
Hi...
I'm trying to get a file address that i stored "manually" in an SQL server database using c#, i stored in the database the string "c:\projects\vids\simpsonslidetector.flv" and when i try to retrive, it ignores everything except "simpsonslidetector"... this is used as webservice, the webservice receives an int so it can match with a certain id in the table and when finds that id, returns the string (in this case not the whole string, in other cases with "simplier" strings it return well):
the table name on the database is 'info' and as 3 colums: id(int), name(nvarchar(100)), address(nvarchar(100))...what type of data should i use for the address?
also i have other methods that connect to the database to return a value or list of values, and goes fine, the only problem is the address string (i think the cause of not getting the result i want, is because, for some reason the reader does not receive the formatted string stored in the database ("c:\projects\vids\simpsonslidetector.flv")).
this is the code i use to retrieve the string:
[WebMethod]
public String getAddressByID(Int32 id)
{
String strReader = "";
SqlConnection conn = new SqlConnection(strCon);
conn.Open();
String readCmd = "SELECT address FROM info WHERE id = " + id.ToString();
SqlCommand cmd = new SqlCommand(readCmd, conn);
strReader = (String)cmd.ExecuteScalar();
conn.Close();
if (strReader == null)
{
return "No Result";
}
else
{
return strReader;
}
}
Reply
Answers (
6
)
Waiting time on HttpWebRequest First time
Error : Cannot convert type 'string' to 'net.webservicex.www.Currency' .