DataSource Controls :: Errors In Passing Values To Stored Procedures?
Jul 28, 2010
I am passing values from textboxes on the webform to my stored procedures where it should insert values passed.
It is giving an error like Cannot implicitly convert type 'string' to 'System.Data.SqlClient.SqlParameter' at place where I am cmdselect.Parameters.Add("@PackageName", SqlDbType.VarChar, 50) = PN; where PN is string type .
View 2 Replies
Similar Messages:
Apr 27, 2010
I am using Visual Studio 2008 and SQL Server 2008 and have added a SQL datasource to my form.
When I configure the datasource, I choose my connection string which looks like this in my webconfig:
<connectionStrings>
<add
name="PSFSPRD_ConnectionString"
connectionString="Data
The database I am using has a schema called EQB and as such, my stored procedures are named as EQB.usp_SelectFunds, EQB.usp_SelectAccount, etc.
On the select tab of the Configure Data Source screen, I choose to use a stored procedure. The dropdown shows my stored procedures, however, the schema name does not show up in front of the stored procedures in the drop down. I see only usp_SelectFunds, usp_SelectAccount, etc.
I select one of the stored procedures and when I click TEST, I get the message that the stored procedure is not found. If I instead choose to use a SQL statement instead on the configuration screen and enter EXEC EQB.usp_SelectFunds and click TEST, it works fine.
Why are my stored procedures not showing up correctly in the stored procedure drop down and how can I fix this?
View 3 Replies
Mar 29, 2010
Im new to ASP.NET (Normally use PHP), and im currently designing a website in VB.NET and SQL Server.
When using LINQ to SQL i know that it uses parametarized queries and we dont need to add them.
So do we need to use Stored Procedures in LINQ (for security reasons)???, If yes How
View 3 Replies
May 7, 2010
How can I encrypt all Stored Procedures of a database at once?
View 3 Replies
Apr 10, 2010
we have sql server running on a server.
when person A connects to sql server from their machine and executes a stored procedure (a stored procedure which runs a query and sends an email) - it executes and the email is received.
when person B connects to sql server from their machine and executes the same stored procedure, it executes but the email is never received.
does this mean the stored procedure is executing locally on both users machines?
if not....then why does person B's execution of the stored procedure not generate the email?
View 2 Replies
May 28, 2010
I want to write dynamic store procedure means 1 select_sp, 1 update_sp, 1 insert_sp, 1_delete_sp for all tables.
How it is used in secured manner.
View 2 Replies
Apr 6, 2010
Should I just write to file before a stored procedure is executed or should I log the stored procedure into a table? If the latter one is recommended, how should I go about doing that?
View 4 Replies
Jan 8, 2010
I am having a problem returning a value from a stored procedure when using SqlDataSource. The stored procedure is executing because 'invoice_no is incrementing but Myreader.HasRows is always false.
Here is the table definition
`invoice_no` int(10) NOT NULL AUTO_INCREMENT,
`employee` varchar(50) DEFAULT NULL,
`create_date` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`invoice_no`)
Here is the stored procedure:
CREATE PROCEDURE `GetInvoiceNumber`(IN username VARCHAR(50), OUT InvoiceNum INT)
BEGIN
INSERT INTO invoice (employee)
VALUES (username);
SELECT MAX(invoice_no) INTO InvoiceNum FROM invoice;
END
And here is my code.
[Code]....
View 2 Replies
May 25, 2010
Ive created a new LINQ To SQL class and dragged several tables across from my server, in my code I access them like this
[Code]....this is all ok, however, I have several stored procedures that I want to use as well, but when I drag the stored procedures across I get a compilatiopn error
Error 60 'DB_BL.DB_BLDataContext': type used in a using statement must be implicitly convertible to 'System.IDisposable'
how do I use stored procedures from LINQ with a using clause ?
View 7 Replies
Jan 6, 2010
can we create overloaded stored procedures in sql server
View 7 Replies
May 12, 2010
how to create stored procedures using vbscript, and how to pass the parameters to the stored procedures...
View 6 Replies
Aug 18, 2010
Is it possible to change the select, insert and update stored procedure of an SqlDataSource at run time. I don't mean to change the definition of the stored procedure, but I mean to change the assignment, i.e. To change the select stored procedure from "selectSP1" to "selectSP2" at run time. Is it possible?
View 4 Replies
Mar 2, 2010
I open a sqlconnection and sqlcommand. I execute a stored procedure and get the scope_identity from that procedure to be used within another procedure that needs to be fired. Unfortuntley if the second procedure fails forwhatever reason the data change for the first procedure commits anyway. I kind of want to do a began transaction end transaction on the c#.net side. Also I need to execute a stored procedure multiple times....
View 2 Replies
Jan 4, 2010
If this is not the appropriate forum for this I didn't see any linq specific forum listed.
I am about to start a new project and I would like to use it as an opportunity to update myself with the newer technologies, like ajax and linq.
All my database CRUD operations will be done by sql stored procedures, does linq still make sense when doing that? I watched a couple introductory videos on linq and none of them dealt with stored procedures, thats why I'm wondering.
View 10 Replies
Jun 9, 2010
I like to use my own stored procs as much as possible.
That way I know exactly what's happening and I can explain and control things.
I'm using stored procs with LINQ to SQL for CRUD operations.
For select, insert and delete - using stored procs with LINQ to SQL is pretty straightforward.
However, if I want to use my own custom stored procs with L2S for updates what's the best way to accomplish this?
Can you provide some code that shows the best approach that you would personally choose for this?
View 1 Replies
Mar 30, 2010
In a pickel here. When I run this code:
[code]...
The only Stored procedure execute is the last one TSD_UpdateTimeCardEndofDay
View 3 Replies
Jan 12, 2010
I have been chasing this erorr all day and coming up blank. I created a stored proceudre(fairly complicated logic), added it to the context, and set the return type to a specific entity type.
It generated this:
[Function(Name="dbo.usp_ServiceTemplateSelectByFkID")]
public ISingleResult<ServiceTemplate> usp_ServiceTemplateSelectByFkID([Parameter(Name="FkId", DbType="Int")] System.Nullable<int> FkId)
{
IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), FkId);
return ((ISingleResult<ServiceTemplate>)(result.ReturnValue));
}
I call it from my service with the following method:
public ISingleResult<ServiceTemplate> GetByFkId(int FkId)
{
return Db.usp_ServiceTemplateSelectByFkId(FkId);
}
I have tested the stored procedure and it returns the results I want. When I make the service call from the controller, it doesn't error out, however, it should return 4 records in this instance and instead, it returns the same 4 records (repeating the first record 4 times).
In addition, in my controller code, I am using the MVCContrib ToPagedList() method which doesn't appear to work with the ISingleResult interface (forward only cursor, I'm guessing). I have attempted converting the service results to IQuery, List, and Array, however, I still have the problem with the first record being repeated 4 times.
View 3 Replies
May 13, 2010
I have access to two servers, one with my development database on, and another with the live database on.
All SQL Stored Procedures, Functions, Views are encrypted on the live database (using WITH ENCRYPTION in my query)
However I'm concerned I might accidentally encrypt a bunch of SProcs on my development database meaning I can no longer view/edit that code.
I have full control over the server and database, and was wondering if there is a way I can prevent these from being encrypted, therefore throwing up an error when this is attempted?
View 4 Replies
May 26, 2010
I was reviewing my old post about this issue with a accessdatasource and that was simple since the Select, Update and Delete were all written within the datasource.
But this page im having issues with is using SQLDataSource and pointing to Store procedures. My issue is that i have created the sqldatasource with Insert(storeprocedure), Select(actual select statement), Update(storeprocedure) and was trying to take advantage of gridviews capabilities for editing when connected to a datasource that has all those elements setup.
Here is my datasource and gridview code: The gridview row goes into edit mode, but the changes never take affect on the database.
[Code]....
View 1 Replies
Aug 24, 2010
I have a database linked to a calendar. I had a peice of code that retrieved dates from a database and populated the calendar. I wanted to tidy up my code using stored procedures (they seem neater & i assume there's a benefit somewhere). so i came up with this, however it's not working. The calendar displays, but it's not being populated with the database entries. The SqlCommand & SqlParameter I have working elsewhere in my code; as with the SqlDataAdapter (which also worked before i tried to conver to a storedprocedure!) but combining these three (SqlCommand, SqlParameter & SqlDataAdapter) seem to be causing me problems.It's probably something stupid but if someone could take a look and point me in the right direction,
[Code]....
[Code]....
View 2 Replies
Sep 7, 2010
I am working on a Tag system for a news page designed in ASP.NET. For the system I require a TagExists method to check for tags within the database. The stored procedure I have written is below.
[Code]....
I have tried switching the procedure to return 0 if the tag exists and 1 if it does not and it still returns 0 despite the exact same testing conditions. I have also returned the actual select query and it has complained of the Tag "news" (my test item) not being an int on execution showing the select itself is definitely properly formed.
View 3 Replies
Aug 13, 2010
how to return list of values(single column values) from stored procedures in sqlserver 2005?
View 4 Replies
Nov 3, 2010
I have the following stored procedure
[Code]....
MOVE_MOD is defined as a float.
Yet within Dataclasses.designer.cs the function gets added as:
[Code]....
Naturally this is causing some issues as my C# code needs to handle decimal values. If I try to manually change the designer code to use floats, I get the following error
'System.Single' is not a valid return type for a mapped stored procedure method.
View 1 Replies
Dec 11, 2010
I have an .ASPX form. All I want to do is simply "Submit" the form field values into a database.
"I have been tasked with re-writing the entire .ASPX form to use "Stored Procedures" instead of a "SQL-String" to insert form values. I think I have most of the form submitting to the database, except the "Radio Buttons" just say "NULL".
I do not know how to progam the Radio Buttons to insert the value (Yes, No, N/A) the user chose into the database. I have GOOGLED but cannot find an answer, and some answers are too complex for my level of understanding at this point.
I need to take the following code and change it so it just calls a Stored Procedure. If you could show me "Stored Procedure" code and how to change my current code to work with the Sproc it would be much appriciated. Here is the code.
I have "11" groups of Radio Buttons I need to change. Here is an example of one of the rows.
<tr>
<td><input type="radio" name="group1" value="yes"></td>
<td><input type="radio" name="group1" value="no"></td>
<td><input type="radio" name="group1" value="N/A"></td>
<td><asp:Label ID="Label22" runat="server" Text="Surfaces exposed to corrosives pH between 5 and 9."></asp:Label></td>
</tr>
Summary: I just want to call a stored procedure and store the value the user chose into my database.
View 5 Replies
Mar 30, 2010
I'm trying to pass the text value of a text box as a query string value to a stored procedure. I was hoping someone could point me in the right direction. Button Code:
[Code]....
Stored Procedure:
[Code]....
The results page datalist:
[Code]....
Code Behind of results page:
[Code]....
I'm sure i've got this entirely backwards. However if I change the NULL value in the stored procedure with some string value (eg."Donkeys") it pulls all the values that contain "Donkeys" into the datalist on my results page.
View 2 Replies