|
Whats the sql query for this table
the fields are : table name=Emp ,date_join current systemdate,
sal,city,state
pabitra behera
|
|
|
|
|
Let me Google that for you[^]
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
|
Hi
I wanted to insert my form into mysql database
Below is the code i used
protected void Submit_Click(object sender, EventArgs e)
{
MySqlConnection connection = null;
if(RadioButton1.Checked==true)
{
lblgender.Text= RadioButton1.Text;
}
else
{
lblgender.Text= RadioButton2.Text;
}
lblbusinessCat.Text=DropDownList1.SelectedValue;
using (connection = new MySqlConnection(ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString))
{
try
{
string sql = "INSERT INTO login(Username, Gender, Email, MobileNo, Category_Id, CompanyArea, CompanyName, CompanyNo, AltCompanyNo, Address)VALUES ('@Username', '@Gender', '@Email', '@MobileNo', '@Category_Id', '@CompanyArea', '@CompanyName', '@CompanyNo', '@AltCompanyNo', '@Address') ";
MySqlCommand cmd = new MySqlCommand(sql);
cmd.Parameters.AddWithValue("@Username", txtUserName.Text.Trim());
cmd.Parameters.AddWithValue("@Gender", lblgender.Text.Trim());
cmd.Parameters.AddWithValue("@Email", txtEmailId.Text.Trim());
cmd.Parameters.AddWithValue("@MobileNo", txtmobile.Text.Trim());
cmd.Parameters.AddWithValue("@Category_Id", lblbusinessCat.Text.Trim());
cmd.Parameters.AddWithValue("@CompanyArea", txtCompanyLoc.Text.Trim());
cmd.Parameters.AddWithValue("@CompanyName", txtCompanyname.Text.Trim());
cmd.Parameters.AddWithValue("@CompanyNo", txtCompNo.Text.Trim());
cmd.Parameters.AddWithValue("@AltCompanyNo", txtCompaltNo.Text.Trim());
cmd.Parameters.AddWithValue("@Address", txtCompAddress.Text.Trim());
cmd.Connection = connection;
connection.Open();
cmd.ExecuteNonQuery();
Session["username"] = txtUserName.Text;
Response.Redirect("Business_NewUpload.aspx", false);
//lblError.Text = "Data Saved";
}
catch (Exception ex)
{
Response.Write("An error occured: " + ex.Message);
//lblError.Text = ex.Message;
Response.Redirect("BusinessMoney_About.aspx", false);
}
finally
{
if (connection != null)
{
connection.Close(); //close the connection
}
}
}
}
i dont get any error , but my values are getting stored as @username,@gender
Please anyone help me.....It is very urgent for me to correct this
|
|
|
|
|
In MySZQL you simply use ? for placeholders in teh SQL statement - eg
string sql = "INSERT INTO login (Username, Gender, Email, MobileNo, Category_Id, CompanyArea, CompanyName, CompanyNo, AltCompanyNo, Address)VALUES (?,?,?,?,?,?,?,?,?) ";
|
|
|
|
|
I have a Gridview that has many pages. I order it by an ID number in descending order which is displayed. When I try to edit the row with my image button, the index I get does not match the row I clicked Edit on. How do I tie the row I clicked Edit on to the index the gvRowEditing method recieves? It gets a GridViewEditEventArgs object but that does not have a Command Argument that can tie the row to.
Thanks!
|
|
|
|
|
Look, my friend;
The edit command of the grid view control fires the events:
- RowEditing: where you set the
EditIndex property. this will load the editing template to render the row you wish to edit. - RowCancelingEdit: fired when edit is canceld.
- RowUpdating: fired when you click the update command. Here you make the actual editing action.
- RowUpdated: fired when the update is done.
you can refer to this page[^] for a good example
Help people,so poeple can help you.
|
|
|
|
|
hi there anyone can help me ....
i have created a database in which i am saving the id[int],name[varchar],visPic[image]
and i have created a search page for the visitor search by id and after searching griedview is visible for the data of visitor and when we click get details in gried view next page will open by auto fill id number, name , and pic in respective control. But i cannot bind the image in image control.Please help me out somebody i will be vry thnkful .....
|
|
|
|
|
You have two options.
If all of your users are using a recent browser, you can use a Data URI[^] to embed the image. It won't work in IE7 or earlier, and IE8 support is limited.
public static string GuessImageMimeType(byte[] data)
{
string result = null;
if (data != null && data.Length > 3)
{
if (data[0] == 71 && data[1] == 73 && data[2] == 70)
{
result = MediaTypeNames.Image.Gif;
}
else if (data[0] == 137 && data[1] == 80 && data[2] == 79)
{
result = "image/png";
}
else if (data[0] == 66 && data[1] == 77)
{
result = "image/bmp";
}
else
{
for (int index = 0; index < data.Length - 2; index++)
{
if (data[index] == 255 && data[index + 1] == 216 && data[index + 2] == 255)
{
result = MediaTypeNames.Image.Jpeg;
break;
}
}
}
}
return result;
}
public static string BuildImageUrl(byte[] data)
{
if (data == null || data.Length == 0) return null;
var sb = new StringBuilder("data:");
string mimeType = GuessImageMimeType(data);
if (!string.IsNullOrWhiteSpace(mimeType)) sb.Append(mimeType);
sb.Append(";base64,");
sb.Append(Convert.ToBase64String(data));
return sb.ToString();
}
<asp:Image runat="server"
ImageUrl='<%# BuildImageUrl((byte[])Eval("visPic")) %>'
/>
If you need support for older browsers, you'll need to create a generic handler to load and return the image based on the ID, and set the ImageUrl to point to that handler:
<asp:Image runat="server"
ImageUrl='<%# Eval("ID", "DisplayVisitorPicture.ashx?ID={0:D}") %>'
/>
There's an example of this approach here: Image Handling In ASP.NET[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Hi!
can someone provide solution for converting image into text
in asp.net?
Thanks
Hidayat Ali
|
|
|
|
|
You have to use OCR in order to convert image into text:
Here you have useful links:
http://www.codeproject.com/Articles/160868/A-C-Project-in-Optical-Character-Recognition-OCR-U
http://www.codeproject.com/Articles/15304/Unicode-Optical-Character-Recognition
http://www.codeproject.com/Articles/11285/Neural-Network-OCR
I hope you enjoy it
|
|
|
|
|
Thanks Mr. Philip and sorry for delay reply
|
|
|
|
|
I have a textbox for quantity,Label drop downlist for different Products.I have a Place holder. and a a ok button. if i give a value of quantity 3 and selct a product suppose mouse the 3 labels with name mouse with 3 text boxes appearing. My problem is i have to display the mouses as mouse1 mouse2 mouse3.how will i do please help.
My code is
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text != "")
{
for (int i = 0; i < Convert.ToInt16(TextBox1.Text); i++)
{
Label la = new Label();
la.Text = DropDownList1.SelectedItem.Value;
la.ID = "abc" + i.ToString();
PlaceHolder1.Controls.Add(la);
//la = FindControl(String.Format(i)) as Label;
TextBox tb1 = new TextBox();
tb1.ID = "ghj" + i.ToString();
PlaceHolder1.Controls.Add(tb1);
PlaceHolder1.Controls.Add(new LiteralControl(" "));
}
}
}
|
|
|
|
|
What's the problem with your code ... ?
Light or darkness, we must choose ...
|
|
|
|
|
Hi! I'm teaching some basic ASP.NET.
I have looked at a solution for login-page.
There is the built in forms-authentication but I seem to work bad.
Login works sometimes and sometimes not. Doesn't seem so stable or maybe I am doing something wrong.
Is this something you would use on a live site?
What else should you use?
|
|
|
|
|
larsp777 wrote: Doesn't seem so stable or maybe I am doing something wrong.
Given that Forms Authentication has been around for 12 years, and is used by a huge number of sites, my money's on option 2.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Ha, ha
Maybe I should read more about it.
|
|
|
|
|
Man;
You know something, Microsoft is the opposite of stability.
Windows itself is not stable that suddenly you get that stupid blue screen and you would loss all your work. Because of that you shouldn't bet on Microsoft product so, you wont loss your money.
Help people,so poeple can help you.
|
|
|
|
|
Thankfully, I haven't seen a BSOD for years, and even then it was dodgy hardware that caused it.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Yes sir it's very difficult understand about the forms Authentication, I have used many time in live project, but every time new problem faced.After some searching on google some idea get, then resolve problem. I used every time web config Authentication, it's simple according to me.
|
|
|
|
|
Hello,
If I search (api/test/cusip=00163&isin=555), I get 10 records showing both of cusip and isin value and 9 records with price_type= cr and 1 record price_type= tk.
However, if I run the following query (api/test?cusip=00163&isin=555&price_type=cr), i only get results from cusip parameters (00163) and nothing from isin and they are also not in a descending order.
This is what I have so far:
public HttpResponseMessage Get([FromUri] Query query)
{
var data = db.database.AsQueryable();
int pageSize = 10;
if (query.price_type != null)
{
data = data.Where(c => c.Cover == query.price_type);
}
int total = data.Count();
var filteredData = new List<IQueryable<database_BWICs>>();
if (!string.IsNullOrEmpty(query.isin))
{
var ids = query.isin.Split(',');
foreach (string i in ids)
{
filteredData.Add(data.Where(c => c.ISINs != null && c.ISINs.Contains(i)));
}
}
if (!string.IsNullOrEmpty(query.cusip))
{
var ids = query.cusip.Split(',');
foreach (string i in ids)
{
filteredData.Add(data.Where(c => c.CUSIP != null && c.CUSIP.Contains(i)));
}
}
if (filteredData.Count != 0)
{
data = filteredData.Aggregate(Queryable.Union).OrderByDescending(c => c.UploadDate).Take(pageSize);
}
if (!data.Any())
{
var message = string.Format("No data was found");
return Request.CreateErrorResponse(HttpStatusCode.NotFound, message);
}
if (query.price_type != null)
{
data = data.OrderByDescending(c => c.Cover == query.price_type).Take(pageSize);
}
return Request.CreateResponse(HttpStatusCode.OK, new { total, data });
}
}
I have tried debugging the issue many times on the following line with search string - http://localhost:32118/api/test?cusip=00163&isin=555&price_type=cr . The application crashes on the data parameter "data = {System.Data.Entity.DbSet<multi.database>} ". I am little unclear what this issue mean?
if (query.price_type != null)
{
data = data.Where(c => c.Cover == query.price_type);
}
Am I missing something? if so, is their a better way to do this? Thanks in advance for your help and time.
modified 7-Feb-14 5:28am.
|
|
|
|
|
Sir;
I don't know what are you trying to do, but I believe that you chooses to do it with the hard way. I don't understand why you applied the each filter alone then you applied 'Union All'.
and I think that you need to mention that you are using ASP.NET MVC Web API.
Help people,so poeple can help you.
|
|
|
|
|
Hi,
I have updated my original post and managed to get half of the issue resolved. I am currently stuck on the price_type parameter on filtering query with pagesize and orderby function.
If anyone could help me out on this issue explained in my original post, that would be very helpful.
Many thanks.
|
|
|
|
|
Ma'am;
From your code, I can extract that your data table has columns:
- Cover: to be match with price type(restrict the data set)
- ISINs: filter
- CUSIP:filter
- UploadDate: descending order
first,you restrict the data to price type. Then you select ISIN matching records and the CUSIP matching ones from the restricted data. lastly, you order the filtered data according to the upload date.
After that you reorder the overall data according to the price type.
In the first request query 'cusip=00163&isin=555' you didn't specify a value for price_type so the lines
if (query.price_type != null)
{
data = data.OrderByDescending(c => c.Cover == query.price_type).Take(pageSize);
}
wont execute. But inn the request 'cusip=00163&isin=555&price_type=cr' you restrict the data to cr price type and execute the above statement which will cancel all ordering.
my recommendation is to remove these lines, and accept me as a friend on facebook.
if you need any further help you should tell me what your data is and what you want to do with it.
by the way what about the number 786?!!
Help people,so poeple can help you.
|
|
|
|
|
Thank you for your response. I am writing to inform, I manage to get the issue resolved by adding the orderby and pagesize filter to filterdata method.
Thank you for your time and suggestions.
|
|
|
|
|