Tracking Forums, Newsgroups, Maling Lists
Home Submit Tracker Forums
  Advanced Search
  HOME    TRACKER    ASP.NET


Advertisements:










Passing Dynamic Parameters To A Mysql Query From Page?


I've a requirement that I need to read an excel sheet programmatically using asp.net/C# and write the data obtained into a mysql table.The excel sheet contains something around 50 columns and 2000 records.I am able to read the data from the excel sheet and store it in a dataset.I am using the following code to write the data into mysql table.

for (int i = 1; i <= myDataSet1.Tables[0].Rows.Count - 1; i++)
{
MySqlCommand cmd = new MySqlCommand();
for (int j = 0; j <= myDataSet1.Tables[0].Columns.Count - 1; j++)
{
paramset[j] = myDataSet1.Tables[0].Rows[i][j].ToString();
cmd.Parameters.AddWithValue("val" + j, paramset[j]);
}
cmd.CommandText = "Insert into faqimport
cmd.Connection=con;
cmd.CommandType = CommandType.Text;
int x=cmd.ExecuteNonQuery;
}

When I try to run the above code I am getting 'Unknown column 'val0' in 'field list'' error.I understand that i am manually creating the parameters val0,val1,val2.....instead I am creating them dynamically using the integer 'j'.But I do not want to create around 50 parameters to insert data into the database table.

Also is there a way i can get the column datatypes from the excel sheet in order to create a new table in mysql with the columns in the excel sheet?


View 1 Replies (Posted: May 20 10 at 14:26)

Sponsored Links:

Related Forum Messages For ASP.NET category:
SQL Server :: Passing Parameters For Select Query To Another Page
Ihave an asp.netsite which includes a "search" page that queries an SQL table, then redirects the user to a "results" page where the results of the query are displayed. The parameters for the query are assembled into a string which is the SELECT statement. I've been asked to add additional functionality that requires a secondary search which takes placeon the "results" page. How can I pass the parameters from the"search" page to the "results" page so that I canaccess those parameters in the code behind? Here's the first page code behind (I inherited most of this from another developer):

[Code]....

And the second page--it would be on line 51 that I would need to insert the parameters from the search above:

[Code]....

Posted: Dec 14, 2010 02:47 PM

View 3 Replies!   View Related
DataSource Controls :: SqlDataSource And Parameters Query / Trying To Accomplish Is Building Dynamic Query
1. I have a GridView on my page and it uses sqldatasource with parameterized query. What I want to do is, on page load (where nothing has been selected so no parameter supplied), I want it to query everything (something like SELECT * FROM [this_table]) but since my SelectCommand is something like

SELECT * FROM [this_table] WHERE [this_column] = @someParameters AND [that_column] = @someParameters.

Can I play around with default value to achieve something like that but how ? Now, when the page loads, it doesn't show anything (No Gridview).

2. On my page, I made something like (username, gender, address, and more) and one single search button. That means, no single control enable auto postback. What I am trying to accomplish is building dynamic query

(if username specifed -> SELECT * FROM [this_table] WHERE [username] LIKE @username).

If both username and gender are specified (SELECT * FROM [this_table] WHERE [username] LIKE @username AND [gender] = @gender) and you know the rest. How can I do this using GridView and SqlDataSource ? To my knowledge, I can only specify one SELECT statement in a sqldatasource.

Posted: Aug 22, 2010 05:18 PM

View 11 Replies!   View Related
Parameters In Query The Database Doesn't Update In C# And Mysql Using Odbc
when i specify values in my update query the query works fine and the database gets updated, but when i use parameters in my query the database does not update here is the code i have written

try
{
OdbcConnection MyConnection = new OdbcConnection(ConfigurationManager.ConnectionStrings["myconn"].ConnectionString);
MyConnection.Open();
String MyString = "UPDATE orddetpabak SET jud1=@jud1,jud2=@jud2,jud3=@jud3,adv=@adv where fil_no=@fil_no AND orderdate=@orderdate";
OdbcCommand MyCmd = new OdbcCommand(MyString, MyConnection);
String j1=DropDownList4.SelectedValue;
String j2=DropDownList5.SelectedValue;
String j3=DropDownList6.SelectedValue;
String j4=TextBox4.Text;
String j5 = HiddenField1.Value;
String j6 = TextBox3.Text;
MyCmd.Parameters.AddWithValue("@jud1",j1);
MyCmd.Parameters.AddWithValue("@jud2",j2);
MyCmd.Parameters.AddWithValue("@jud3",j3);
MyCmd.Parameters.AddWithValue("@adv",j4);
MyCmd.Parameters.AddWithValue("@fil_no",j5);
MyCmd.Parameters.AddWithValue("@orderdate",j6);
Response.Write(DropDownList4.SelectedValue);
Response.Write(" " + DropDownList5.SelectedValue);
Response.Write(" " + DropDownList6.SelectedValue);
Response.Write(" " + TextBox4.Text);
Response.Write(" " + HiddenField1.Value);
Response.Write(" " + TextBox3.Text);
MyCmd.ExecuteNonQuery();
//MyConnection.Close();
}
catch(Exception epp)
{
Response.Write(epp);
}

Posted: Nov 30 10 at 10:22

View 1 Replies!   View Related
Forms Data Controls :: Passing Variables Into And Out Of Mysql Query
First up i would like to apoligize for these questions that are proable realy easy. I have been put on the spot by my boss and have been told to change all my php to asp.net c so it can go in this new cms i have at work. I have just spent the last 18 hours trying to get this to work and im geting a little desperate.

Ok so my current issue is that i dont know how to add html formating to a result string i pull out of my mysql database. I have my result sheet pulling into a gridview, what i want to do is put some information drawn from each row in the gridview out side of the <Tr> tag. Is this possible? But within the Table Tag second issue is it possiple to feed data into a page and then run a mysql query like i was doing in php.

Posted: Jan 09, 2010 09:53 PM

View 1 Replies!   View Related
Forms Data Controls :: Pass Two Parameters As A Query String To Hyperlink PlanID - Passing Paramters To Querystring
i want to pass two Parameters as a query string to Hyperlink PlanID and Year now where i have to assigin the values i put below hyperlink in Item Template of Gridview Control.

[Code]....

It will automatically bind the values or i have to assign them values i mean to PlanID and Year.

it is giving me error that No overload for method 'Eval' takes '3' arguments

Posted: Dec 02, 2009 04:38 AM

View 5 Replies!   View Related
Embed MySQL Query Browser In Web Page?
I want to be able to query databases that aren't on our servers (other public hospital databases) without downloading the standalone MySQL Query Browser. Would there be a way to do this in a web browser?

Posted: Jun 29, 2009 03:18 PM

View 1 Replies!   View Related
Web Forms :: Passing Parameters From A Datalist To Another Page?
passing parameters from a datalist to another page.

this is how my app works:

i have a database ( access) a table with the following columns: id,title,desc,photo.

another table with the following columns: (startsin, endsin,price,tId)

on the first page (tourpack.aspx) i have a datalist, when user clicks on a button that is in the templateitem of the datalist, he will be transfered to another page called (showtour.aspx). what im trying to do is passing the ID parameter from the first page (table 1) to the second page (showtour.aspx) with the id number so he can see the specific details of that "tour" that are located In the second table.

Posted: Jun 11, 2010 05:06 AM

View 8 Replies!   View Related
Web Forms :: Passing Parameters Passed With The Page?
I wanna pass multi parameters from one page to other ,but one of these parameters is already passed with the first page , how to pick up and pass it ?

Posted: Sep 06, 2009 07:48 AM

View 5 Replies!   View Related
Passing Parameters To OnLoad In Aspx Page From Javascript?
I have this javascript

function myFunction(source) {
window.open(source, "Title", 'width=400, height=400');
}

and in c# code I call it by

HtmlPage.Window.Invoke("myFunction", source);

which opens up a aspx page and goes to its OnLoad function:

protected override void OnLoad(System.EventArgs e)
{
base.OnLoad(e);

how do I pass in parameters to the event args in the aspx page? or is that even possible? and how can I pass these parameters from my c# code to the javascript?

Posted: Aug 11 10 at 0:30

View 2 Replies!   View Related
SQL Reporting :: Passing Parameters To SSRS Report From Web Page?
I have a web page that displays some data. When they click a submit button, I want to run a report. But I would like to pass the start year/month and end year/month values that the user already entered on the web page to the report. Here is what my url looks like when the report is displayed:

http://xyzserver/Reports/Pages/Report.aspx?ItemPath=%2fReports%2fDevicesAllNew&rs:Command=Render&StartYYMM=201007&EndYYMM=201008

But my report displays the 2 textboxes for my StartYYMM and EndYYMM parameters as empty. What am I doing wrong? I did a google search and I saw something about using ReportServer instead of ReportManager. I notice at the top of the browser when I run my report, it reads "Report Manager - Windows Internet Explorer". Is this correct?

Posted: Sep 02, 2010 03:40 PM

View 3 Replies!   View Related
HttpHandlers / Modules :: Passing Parameters From Webpage To Generic Handler Page?
Q.how to pass parameters from webpage to Generic Handler page and how to receive them

1. When the user clicks a button I want to pass 2 parameters to the 'ViewImage' page. The code below passes just 1 parameter (concatenates the variablessToolGUID and lGrid). Can I split the parameters up or do I have to split them up in the 'ViewImage' page?[Code]....

2.The code below in the 'ViewImage' generic handler pagereceives 2 parameters from the webpage(if I can send 2 parameters). But how would i use the string instead of the index (querystring["..."]). It looks like I can only use the string querystring["id"] to retrieve the parameter.

[Code]....

I get the impression I can only send 1 parameter then use the split function to seperate the querystring but surely there is a way to send 2 parameters and why do I have to use an index?

Posted: May 20, 2008 10:59 AM

View 6 Replies!   View Related
Passing Parameters From One Page To The Next Page With Vb?
I don't know if this is the right section to post this but here goes, I am having trouble in passing parameters from one page to the next in my web application. I thought by having all my classes public i could get access to the variables globally but that is not the case. I have two forms: index.aspx and room.aspx, on the index page when a user selects any room from the drop down list e.g room 1 or room 2 and clicks next i want to pass the room parameter to the room page and on the room page i want it to check whatever room is selected from the index page then show that room in the image box.

Posted: Dec 15th, 2009, 06:29 AM

View 8 Replies!   View Related
Databases :: Mysql Query / Right Query If The Room Is Already Booked?
I doing a simple reservation system and i am trying to figure whats the right query if the room is already booked?.. i only know basic mysql queries . here is my DB Table.

[URL=http://img94.imageshack.us/i/91425914.png/][IMG]http://img94.imageshack.us/img94/4449/91425914.th.png[/IMG][/URL]

Posted: Oct 11, 2009 09:25 PM

View 3 Replies!   View Related
Web Forms :: Passing Gridview Page And Sorting Via Query String?
I have a gridview and a few text fields to filter the gridview results. I want that the whole filtering is visible in the query string so the user can simply copy the [URL] and send it to his buddy who sees exactly the same result like him or just save it in his browser bookmarks. how do i perform it right now? i have one search button on my items.aspx site that builds the query string like the example above and opens it via Response.Redirect. on page_load i check for the query strings and assign them back to the controls. the controls are wired to the gridview by databinding. this approach works good but is it the right way to realize such functionality or is there a better/cleaner way? here comes the dirty part... i also want to transfer the current page and sorting via query string and this is how i realized it:

[Code]....

I use the Session Objects to build the query string and open the url.on gridview_databound i apply the sorting

[Code]....

here you can see that i mess around with the events to avoid infinite loops.

Posted: May 12, 2009 05:19 PM

View 1 Replies!   View Related
Web Forms :: Passing Query String Between 2 Frames In An Aspx Page?
I'm having an aspx page with 2 frames, one is the header and the the other one is content frame which i'm trying to load it dynamically. Everything is fine. Let me explain my scenario

On the header frame i'm having 5 link buttons and when a link button is clicked i'm passing a hardcoded Page URL to the frames containing page and then trying to load that page in the content frame.

Below is my code, Everything as far as i know are in right place, but i cannot see the page in content frame..

Header.aspx.cs

[Code]....

Then checking frameURL querystring in default.aspx page load:

[Code]....

when the querystring is null, the SiteSummary.aspx page is getting loaded in content frame without any issue, but when there is a querystring value the page is not being loaded.
Here is my Default.aspx page

[Code]....

Posted: Aug 13, 2010 10:06 AM

View 5 Replies!   View Related
How To Get The Individual Parameters From The List Of Dynamic Parameters In A Webmethod
I am using jquery ajax method on my aspx page,which will invoke the webmethod in the code behind.Currently the webmethod takes a couple of parameters like firstname,lastname,address etc which I am passing from jquery ajax method using

data:JSON.stringify({fname:firstname,lname:lastname,city:city})

now my requirement has been changed such that,the number and type of parameters that are going to be passed is not fixed for ex.parameter combination can be something like fname,city or fname,city or city,lname or fname,lname,city or something else.So the webmethod should be such that it should accept any number parameters.I thought of using arrays to do so, as described here.

But I do not understand how can I identify which and how many parameters have been passedto the webmethod to insert/update the data to the DB.

Posted: May 12 10 at 11:32

View 4 Replies!   View Related
Web Forms :: Passing Query From A Selected Item In A Dropdown List To A Different Page?
I need to get a query after the user has select an item from a list I have a list of cities and I need that after the user has select a city to get the result from my db in a different page

I have tried first to pass it to a lable but this is also not working ...

[Code]....

[Code]....

Posted: Aug 24, 2009 12:41 PM

View 10 Replies!   View Related
Databases :: Using Parameters In TableAdapter - ODBC Connection To MySql
Iam currently making a website on asp.net and i am creating methods using TableAdapter. I am connected to MySql using an ODBCconnection. The select * from department will work perfectlyfor me but when trying to use parametersi am given an error message on the wizard. select * from department where name = @name gives me the error: Error in where clause near '@' unable to parse query text. also tried select * from department where name = ?: this gives me the error: No mapping exists from dbTypeObject to a known Odbc type.

Posted: Feb 15, 2011 03:20 PM

View 3 Replies!   View Related
Databases :: Can't Send Parameters To A MySQL Stored Procedure
I'm having a problem to send parameters to MySQL Stored Procedure.

Here's the C# code:

[Code]....

Posted: Jan 13, 2009 01:37 AM

View 7 Replies!   View Related
Databases :: MySQL Must Use ODBC Connector - Trying To Pass Parameters?
I am with GoDaddy (yeah, yeah, don't want to hear it) and must use ODBC to connect to my MySQL database. The connections are working fine but I have a GridView/DetailsView parent/child relationship set up between 3 pages. I know that these pages worked with a .NET Connector locally but after I changed them to ODBC, I only get the first part of the page, nothing that depends on data being selected works. This has led me to believe that I must alter the way I pass parameters to the next request page. I have read some things about using a question mark but I cannot figure out how I should apply it to my page as most examples are in C# or VB. My page is mostly pure ASP.NET and I'm not sure if I still continue to utilize the asp:ControlParameter. the code below.

how to get GoDady to alter their medium trust to accept sockets???? That's all it would take

This is the page my employees will use to view the people in the database and then select them and have a details view of that particular cust_code (customer code) pop up to the right of the gridview:

[Code]....

This is the page ( UpdatePrefCustomers.aspx ) that my employees, who will be allowed access it (yes, I already know how to apply authorization but will do it last before deployment so it doesn't drive me crazy when I preview in browser), will use to add, edit, and delete from the database. It must be accessed first and the other two pages, prefcust_edit.aspx and prefcust_insertt.aspx are called from it by passing the parameter cust_code:

[Code]....

Here is the prefcust_edit.aspx page:

[Code]....

Here is the prefcust_insert.aspx page:

[Code]....

Posted: Jan 19, 2010 04:29 AM

View 8 Replies!   View Related
Databases :: Passing Parameter Using ODBC - Mysql?
I'm having problem on passing parameter on odbc because it's not working at all. I tried this using sql and I have no problem at all. All are working fine. Is there a different syntax on odbc? Here's my code:

[Code]....

Or using mysql connector/net to use mysql. I'm having problem installing it because the visual studio integration is not working, so I can't find it on the data source provider.

Posted: Sep 03, 2010 02:30 AM

View 12 Replies!   View Related
DataSource Controls :: Use Is Null In Query Without Using Parameters For It Or Should Use Parameters For This Field Where Value Is NULL
here is my code for selectiong some records from db table

string strSql = "select * from mtblNBD where SentTo=@SentTo and InternalStatus Is NULL order by DeadLine desc";
SqlCommand com = new SqlCommand(strSql, con);
com.Parameters.Add("@SentTo", SqlDbType.NVarChar, 50).Value = (string)Session["uname"];

here I am using parameters for SenTo field but not for NULL so it is ok... or should I use parameters for this field where value is NULL , if yes then how can I use parameter for this

Posted: Jan 21, 2010 05:21 AM

View 8 Replies!   View Related
Calling A Stored Procedure In Mysql From .NET Throws Error - All Parameters Must Have Their Type Explicitly Set
I have a page which submits a form in my local system but in my production system when i click my submit button it just freezes with the error in my web developer toolbar saying Error: Sys.WebForms.PageRequestManagerServerErrorException: When calling stored procedures and 'Use Procedure Bodies' is false, all parameters must have their type explicitly set.

Posted: Jul 15 10 at 11:00

View 1 Replies!   View Related
C# - What Is Passing Parameters To SQL
In this answer to my question of how to insert data into SQL Server he mentioned passing parameters instead of string concatenation like I currently have.

Is this really necessary for security? If so, what exactly is passing parameters? When i google it I get a lot about stored procedures. Is that what I want, I do not know about stored procedures....yet.

EDIT:

Ok, here is what I got. It seems to update the database correctly and eventually I will change the hard coded ints to inputs from a label. confirm if how I did this is not vulnerable to any sql injection or hacks.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
public partial class Stats : System.Web.UI.Page
{
public SqlDataReader DataReader;
public SqlCommand Command;
string queryString = ("INSERT INTO UserData (UserProfileID, ConfidenceLevel, LoveLevel, HappinessLevel) VALUES (@UID, @CL, @LL, @HL);");
//string queryString = ("INSERT INTO UserData (UserProfileID, ConfidenceLevel, LoveLevel, HappinessLevel) VALUES ('a051fc1b-4f51-485b-a07d-0f378528974e', 2, 2, 2);");
protected void Page_Load(object sender, EventArgs e)
{
LabelUserID.Text = Membership.GetUser().ProviderUserKey.ToString();
}
protected void Button1_Click(object sender, EventArgs e)
{
//connect to database
MySqlConnection database = new MySqlConnection();
database.CreateConn();
//create command object
Command = new SqlCommand(queryString, database.Connection);
//add parameters. used to prevent sql injection
Command.Parameters.Add("@UID", SqlDbType.UniqueIdentifier);
Command.Parameters["@UID"].Value = Membership.GetUser().ProviderUserKey;
Command.Parameters.Add("@CL", SqlDbType.Int);
Command.Parameters["@CL"].Value = 9;
Command.Parameters.Add("@LL", SqlDbType.Int);
Command.Parameters["@LL"].Value = 9;
Command.Parameters.Add("@HL", SqlDbType.Int);
Command.Parameters["@HL"].Value = 9;
Command.ExecuteNonQuery();
}
}

Posted: Jul 9 10 at 20:15

View 7 Replies!   View Related
Passing Parameters To Usercontrol?
when i worked in .NET 1.1 i used to pass parameters to user control using the method- (if the name of the usercontrol is "tables")

dim r As tables =
CType(Page.LoadControl("~/usercontrol/tables.ascx"), tables)

and calling public property of the usercontrols.

the problem is that i can't the way to do it in 2008 ver of .NET, it is not recognize the usercontrol.... how can i pass parameters to the usercontrol in run time?

Posted: Apr 21, 2010 02:05 PM

View 10 Replies!   View Related
MVC :: Passing Parameters To ListView
[Code]....
and my Index
[Code]....

Posted: Oct 09, 2010 12:07 PM

View 1 Replies!   View Related
C# - Passing Parameters With Conditionally?
i have a dropdownlist with seven different optins like (date, subject, press, cia, media...) and user will select one of the item from the dropdownlist and click on search button to get the results.here is my repository class GetInquires method which accepts 7 parameters but it will pass only one prameters at a time to the storeproc and in case of Date (it will pass both from/to)

public List<Inquiry> GetInquiries(string fromDate, string toDate,
string subject, string press,
string cia, string media,

[code]...

Posted: Aug 3 10 at 14:26

View 6 Replies!   View Related
How To Replace " With " In A Mysql Query
I am trying to run this SQL from ASP.NET 2005 but am getting an invalid SQL error because it has a weird character " in it. In my code I am trying to replace " with " but it is not doing it as the special character in the replace command is changing to ".Query:

insert into userquery(description)
values ('In fact, Topeka Google Mayor Bill Bunten expressed it best: "Don't be fooled. Even Google recognizes that all roads lead to Kansas, not just yellow brick ones."')

If I copy and execute this in mysql it is working good.

Posted: Apr 2 10 at 18:32

View 4 Replies!   View Related
Passing Dataset To SelectMethod But With Parameters
I followed this link. It works but in my method I have to pass a parameter. Prod_ID.

[URL]

1. Class is done

2. I just dont know how to pass the parameter from the product.aspx page. I am getting ObjectDataSource 'dsObj' could not find a non-generic method 'GetProducts' that has no parameters.

Posted: Apr 7 09

View 2 Replies!   View Related
SQL Reporting :: Passing Parameters Through Sub Reports?
I am trying to use a parameter field where there is a subreport in my main reportbut i keep getting the error "subreport cannot be shown" whenrunningthe report.

p.s - I have just set the parameters the same in the subreport as the main report.

Posted: Aug 24, 2010 09:49 AM

View 2 Replies!   View Related
Passing Parameters To Cmd.exe To Compile Or Run A C# Program?
I am new to this community.I am developing a website in which there is button with which you can compile a given C# program Using Cmd.exe.I used

System.Diagnostics.Process.Start(@"C:Program FilesMicrosoft Visual Studio 9.0Common7IDEdevenv.exe",@"C:VSprogram.cs");

this will only pop the Visual Studio by loading program.cs file and

System.Diagnostics.Process.Start(@"C:WindowsSystem32Cmd.exe",@"C:VSprogram.cs");

this will jus pop cmd prompt but i want to open cmd.exe by passin the program and Run commands as parameters so that it will Run the given program with visual Studio Command prompt.I dont want user to compile the program manually but i want the button itself compiles the program and shows him the output screen in cmd prompt or in a notepad(notepad becuase the programs are simple example programs).The function which i wanna write would look like thisRun(String FilePath,String CmdName) to pass filepath and Command to Cmd prompt or something which you suggest me to write .My only aim is to compile given file and pop the results in notepad or in command prompt.

Posted: May 28, 2009 03:27 PM

View 10 Replies!   View Related
Web Forms :: Passing Parameters To New Window
I have a page with a lot of pictures on it. I want the user to be able to click on the picture and either bring up a popup type of window passing it the Param name and value , or to have the picture be replaced with this object.

<object id="ADR2" type="application/x-Autodesk-DWF"
width="250" height="250"><param name="dwffilename"
value="path" /> </object>

I have found a number of places describing how to bring up a popup window, but not on how to pass it the values.

Posted: May 23, 2010 04:56 PM

View 2 Replies!   View Related
Web Forms :: Passing Parameters To ExpressionBuilder
I have a customExpressionBuilder in whixh I'm trying to add a list of optional parameters. My method would be declared as follows:
public static string GetResource(string expression, params object[] parameters) { }

The way I'm calling this method from an ASP.NET page is this at the moment:
<ext:Button ID="btnEdit" runat="server" Text="<%$ AppResources :edit_text %>">
Does anyone know how to perform this method call, but using optional parameters?

Posted: Nov 08, 2010 01:37 PM

View 6 Replies!   View Related
MVC :: Passing Parameters From View To Controller?
How do you pass values from aView to a Controller? I have an Html.DropDownListin a view, and need to get the selected value/text back to the controller.

[Code]....

[Code]....

Posted: Dec 23, 2009 06:38 PM

View 6 Replies!   View Related
Passing Multiple Parameters To Web Service
I have a simple Web Service method defined as:

[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string MyWebMethod(string foo, string bar)
{
// DataContractJsonSerializer to deserialize foo and bar to
// their respective FooClass and BarClass objects.
return "{"Message":"Everything is a-ok!"}";
}
I'll call it from the client via:
var myParams = { "foo":{"name":"Bob Smith", "age":50},"bar":{"color":"blue","size":"large","quantity":2} };
$.ajax({
type: 'POST',
url: 'https://mydomain.com/WebServices/TestSvc.asmx/MyWebMethod',
data: JSON.stringify(myParams),
contentType: 'application/json; charset=utf-8',
dataType: 'json',
success: function (response, status) {
alert('Yay!');
},
error: function (xhr, err) {
alert('Boo-urns!');
}
});
However, this yields the following error (a breakpoint on the first line in MyWebMethod() is never hit):
{"Message":"No parameterless
constructor defined for type of
u0027System.Stringu0027.","StackTrace":"
at
System.Web.Script.Serialization.ObjectConverter.ConvertDictionaryToObject(IDictionary2
dictionary, Type type,
JavaScriptSerializer serializer,
Boolean throwOnError, Object&
convertedObject)
at
System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeInternal(Object
o, Type type, JavaScriptSerializer
serializer, Boolean throwOnError,
Object& convertedObject)
at
System.Web.Script.Serialization.ObjectConverter.ConvertObjectToTypeMain(Object
o, Type type, JavaScriptSerializer
serializer, Boolean throwOnError,
Object& convertedObject)
at
System.Web.Script.Services.WebServiceMethodData.StrongTypeParameters(IDictionary2
rawParams)
at
System.Web.Script.Services.RestHandler.InvokeMethod(HttpContext
context, WebServiceMethodData
methodData, IDictionary`2
rawParams)
at
System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext
context, WebServiceMethodData
methodData)","ExceptionType":"System.MissingMethodException"}

I'd like to pass in two string parameters and use DataContractJsonSerializer to write new Foo and Bar objects. Am I missing something?

Posted: Oct 6 10 at 13:31

View 3 Replies!   View Related
ADO.NET :: Passing Values To TableAdapter Parameters?
I am creating aDataSet to attach to a report (*.rdlc). In the DataSet is a TableAdapter that has the GetData(@start, @end) function. Can someone please explain how I get values in to @start and @end? I have searched and seen that it might have something to do with overriding the Fill function in theDataSet code behind file. Please let me know.

Posted: Nov 12, 2010 11:14 AM

View 1 Replies!   View Related
AJAX :: Passing The Parameters In Sql Datasource?
I have used a sql data source to connect to ORACLE.

Select command is working fine, as soon as I try to provide a parameter, it doesn;t work.

Getting following error "ORA-01036: illegal variable name/number"

Tried searching for error message -- but It says the parameters name has to be less then 32 characters, which is what I have.

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DevConnection %>"
ProviderName="<%$ ConnectionStrings:DevConnection.ProviderName %>" SelectCommand="Select ID, Name from Employee where state = @stateid">
<SelectParameters>
<asp:ControlParameter Name ="stateid" ControlID = "drdState" PropertyName = "SelectedValue" />
</SelectParameters>

Posted: Mar 13, 2011 10:26 PM

View 2 Replies!   View Related
C# - Passing Parameters In Windows Service?
I want to develop a windows service which will be accepting a datatable from an aspx page. Both the windows service and the website are hosted on same machine.

Also I need to set a date and time on which this service is to work. this date and time are to change according to customer needs. once again the date and time are to be fed from the aspx page.

Posted: Aug 18 10 at 13:19

View 6 Replies!   View Related
C# - Get Date From Datetime Field Mysql Query?
I want to fetch date from a datetime field, when i select this field in database i get the result as 'yyyy-mm-dd hh:mm:ss' i want the result to be like dd/mm/yyyy

I am developing website using ASP.net C# using Mysql.query i have made is:

//***to get next date
string nextdatequery = "SELECT next_dt
FROM testcase.heardt where fil_no=?
and next_dt>?;";

Posted: Dec 24 10 at 6:53

View 2 Replies!   View Related
Copyright 2005-08 www.BigResource.com, All rights reserved