Error While Creating SQLDataSource
May 20, 2008
Hello All
im developing web application in VS2005(C#)
while Creating SQLDATASource for Gridview im getting Following error
cannot get web application service
Please help ME
Regards
Balagangadharan.R
View 3 Replies
ADVERTISEMENT
Apr 17, 2007
Hello. Im trying to create an SQLDataSource control programmatically. I need to do this because I want to do some stuff on my MasterPage's 'Page_Init' event.
heres my code (Master.master.vb): Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
lblUser.Text = Page.User.Identity.Name
Dim PUser As New ControlParameter
PUser.ControlID = "lblUser"
PUser.Name = "LoginName"
PUser.PropertyName = "Text"
PUser.Type = TypeCode.String
PUser.DefaultValue = Page.User.Identity.Name
Dim SQLDS_Login As New SqlDataSource
SQLDS_Login.ID = "SQLDS_Login"
SQLDS_Login.ConnectionString = "I put conection string here. How do I use the one on my web.config?"
SQLDS_Login.SelectCommand = "SELECT [LoginID], [LoginName], [Role], [Status] FROM [myLogin] WHERE ([LoginName] = @LoginName)"
SQLDS_Login.SelectParameters.Add(PUser)
SQLDS_Login.SelectCommandType = SqlDataSourceCommandType.Text
GridView1.DataSource = SQLDS_Login
GridView1.DataBind()
End Sub
When i run, i get this error message:
The SqlDataSource control 'SQLDS_Login' does not have a naming container. Ensure that the control is added to the page before calling DataBind.
I never had any problem with Inserts, Updates and Deleting, but I have never made it work for Select when doing it programmatically.
Can you help me with this?
View 1 Replies
View Related
Sep 19, 2006
I am able to connect but when I try to use the advanced sql generation options the two check boxes are non enabled (generate insert, update, and delete statementsuse optimistic concurrencywhat is happening the user id has permissions to update/delete/select from the selected table
View 1 Replies
View Related
Nov 24, 2007
Hi, I've got some problems with SqlDataSource. The error is:Format of the initialization string does not conform to specification starting at index 74.which is connected to this InsertCommand:SqlDataSource1.InsertCommand= "insert into Candidate([username], [password], [name], [surname], [emailk], [PESEL], [street], [number], [number2], [ZIP], [city], [phone]) values ("+"'"+Label2.Text + "'" + "," + "'" + Label1.Text + "'" + "," + "'"+TextBox3.Text+"'" + "," + "'"+TextBox4.Text+"'" + "," + "'"+TextBox6.Text+"'" + "," + "'"+TextBox5.Text+"'" + "," + "'"+TextBox8.Text+"'" +","+ "'"+TextBox9.Text+"'"+","+"'"+TextBox10.Text+"'"+","+"'"+TextBox11.Text+"'"+","+"'"+TextBox12.Text+"'"+","+"'"+TextBox13.Text+"'"+");"; SqlDataSource1.Insert(); I use MS Visual Studio and SQL Server. Has anyone ever had such problems? All ideas will be appreciated.Regards,N.
View 4 Replies
View Related
Mar 31, 2008
Hi,this is my code: string userName = User.Identity.Name; //COMPANY2 SqlDataSource ds = new SqlDataSource(); ds.ConnectionString = ConfigurationManager.ConnectionStrings["LocalSqlServer"].ConnectionString; ds.SelectCommandType = SqlDataSourceCommandType.StoredProcedure; ds.SelectCommand = "ups_GetCampaigns"; ds.SelectParameters.Add("@USERNAME",TypeCode.String, userName); gridCampaignSummary.DataSource = ds; gridCampaignSummary.DataBind();and this is the error:System.Data.SqlClient.SqlException was unhandled by user code Message="Procedure or function 'ups_GetCampaigns' expects parameter '@USERNAME', which was not supplied."What am i doing wrong? The correct username is comming through.thanksBryan
View 2 Replies
View Related
Jun 20, 2008
hi, i have a stored procedure as follows:create PROCEDURE SelectFrom_tblGoldRateASBEGIN Begin Select A.ID, A.TDate As Date, A.Karat, A.Rate, A.CurrencyID, B.Description As Currency Into #temp1 From tblGoldRate A, tblCurrency B Where A.CurrencyID = B.ID End Select * from #temp1ENDGO I am connecting it through SqlDatasource as follows :<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Sqlcon %>" SelectCommand="SelectFrom_tblGoldRate" SelectCommandType="StoredProcedure"> Now when i am saying refresh schema i am getting error as:Unable to retrieve schema. Ensure that the connectionstring and SelectCommand properties are valid.Invalid object name '#temp1' what's the problem here ????????
View 3 Replies
View Related
Jan 4, 2007
Hello there,
I made a page to add these fields (name, description, price, end_date) into a SQL database. I'm using ASP.NET 2.0 with C#, my database is SQL 2005.
I did it without DetailsView or FormView, it consists of TextBoxes and a Calendar. Anyways, i wrote this code for Button1, which is the button that adds the data.
protected void Button1_Click(object sender, EventArgs e)
{
SqlDataSource sql = LoginView1.FindControl("SqlDataSource1") as SqlDataSource;
sql.Insert();
Response.Redirect("home.aspx");
}
The parameters and insert statments and commands are written from the SqlDataSource Insert Query wizard. But I keep getting this error when trying to click Button1.
Object must implement IConvertible.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidCastException: Object must implement IConvertible.Source Error:
Line 31: {
Line 32: SqlDataSource sql = LoginView1.FindControl("SqlDataSource1") as SqlDataSource;
Line 33: sql.Insert();
Line 34: Response.Redirect("home.aspx");
Line 35: }
Source File: c:Documents and SettingsDoublethink..!!My DocumentsVisual Studio 2005WebSitesSunnDarkProjectsell.aspx.cs Line: 33
Any ideas how to fix this?
View 4 Replies
View Related
Jan 19, 2007
Hello:
I am having a little issue with an error that is frustrating me. I have a SqlDataSource within an asp:label control and also have a two dropdownlists inside that asp:label control also. When I select from the first dropdownlist, it should enable the second dropdownlist with the populated data, but instead I receive.
The SqlDataSource control 'sqlGetMLSByCity' does not have a naming container. Ensure that the control is added to the page before calling DataBind.
Any ideas why this would be? Here is the web from portion:
<asp:Label ID="recip_form_request" runat="server" Visible="false"> <ul> <li>Step one: Select listing type.</li> <li>Step two: Select the City that you are reciprocating to.</li> <li>Step three: Complete the Recip Form.</li> </ul> <asp:DropDownList ID="recip_form_type" runat="server" AutoPostBack="true" Visible="False"> <asp:ListItem Value="0" Text="(Select Form)"></asp:ListItem> <asp:ListItem Value="1" Text="Residential"></asp:ListItem> </asp:DropDownList> <br /> <asp:DropDownList ID="outside_assoc_cities" runat="server" AutoPostBack="True" Enabled="False" DataTextField="city" DataValueField="id" Visible="False"></asp:DropDownList><br /> <asp:Label ID="city_mls_desc" runat="server"></asp:Label><br /> <asp:Button ID="page1_btn" runat="server" Text="Next >>" Visible="False" /> <asp:SqlDataSource ID="sqlCities" runat="server" ProviderName="System.Data.SqlClient" ConnectionString="<%$ AppSettings:connectionstring %>" SelectCommandType="Text" SelectCommand="SELECT id, city FROM tCityMaster"></asp:SqlDataSource> <asp:SqlDataSource ID="sqlGetMLSByCity" runat="server" ProviderName="System.Data.SqlClient" ConnectionString="<%$ AppSettings:connectionstring %>"> <SelectParameters> <asp:ControlParameter ControlID="outside_assoc_cities" Name="City" /> </SelectParameters> </asp:SqlDataSource></asp:Label>
then the code behind:
Protected Sub outside_assoc_cities_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles outside_assoc_cities.SelectedIndexChanged If outside_assoc_cities.SelectedIndex > -1 Then Dim ItemId As Integer = Integer.Parse(outside_assoc_cities.SelectedValue) Dim MLSID As String = Nothing
Dim cmd As New SqlCommand Dim con As New SqlConnection cmd.Connection = con
Dim sqlGetMLSByCity_sql As SqlDataSource = CType(Page.FindControl("sqlGetMLSByCity"), SqlDataSource) 'using connectionstring from SqlDataSource Control con.ConnectionString = sqlGetMLSByCity_sql.ConnectionString 'con.ConnectionString = sqlGetMLSByCity.ConnectionString
cmd.CommandType = CommandType.Text cmd.CommandText = "SELECT mls_id FROM pwaordev..tCityMaster WITH(NOLOCK) WHERE ID=@ID"
cmd.Parameters.Add("@ID", SqlDbType.Int, 4).Value = ItemId
Try con.Open() MLSID = cmd.ExecuteScalar con.Dispose() cmd.Dispose() Catch ex As Exception con.Dispose() cmd.Dispose() Response.Write(ex.ToString()) End Try
'Further logic to display button depending on MLS If Not String.IsNullOrEmpty(MLSID) Then If MLSID = "B" Then city_mls_desc.Text = "The MLS system that covers " & outside_assoc_cities.SelectedItem.Text & " is Greater South Bay MLS." page1_btn.Visible = True ElseIf MLSID = "A" Then city_mls_desc.Text = "The MLS system that covers " & outside_assoc_cities.SelectedItem.Text & " is Big Bear BOR, MLS, which is not covered by Pacific West Association of REALTOR®, please contact us for more information." page1_btn.Visible = False ElseIf MLSID = "C" Then city_mls_desc.Text = "The MLS system that covers " & outside_assoc_cities.SelectedItem.Text & " is Combined L.A./Westside MLS." page1_btn.Visible = True ElseIf MLSID = "F" Then city_mls_desc.Text = "The MLS system that covers " & outside_assoc_cities.SelectedItem.Text & " is Crisnet MLS, which is not covered by Pacific West Association of REALTOR®, please contact us for more information." page1_btn.Visible = False ElseIf MLSID = "Y" Then city_mls_desc.Text = "The MLS system that covers " & outside_assoc_cities.SelectedItem.Text & " is DCAoR - Yucca Valley Area, which is not covered by Pacific West Association of REALTOR®, please contact us for more information." page1_btn.Visible = False ElseIf MLSID = "D" Then city_mls_desc.Text = "The MLS system that covers " & outside_assoc_cities.SelectedItem.Text & " is Desert Area MLS." page1_btn.Visible = True ElseIf MLSID = "L" Then city_mls_desc.Text = "The MLS system that covers " & outside_assoc_cities.SelectedItem.Text & " is i-Tech Glendale/Pasadena." page1_btn.Visible = True ElseIf MLSID = "M" Then city_mls_desc.Text = "The MLS system that covers " & outside_assoc_cities.SelectedItem.Text & " is MRM - Multi-Regional MLS." page1_btn.Visible = True ElseIf MLSID = "R" Then city_mls_desc.Text = "The MLS system that covers " & outside_assoc_cities.SelectedItem.Text & " is RIM - Rim of the World MLS, which is not covered by Pacific West Association of REALTOR®, please contact us for more information." page1_btn.Visible = False ElseIf MLSID = "G" Then city_mls_desc.Text = "The MLS system that covers " & outside_assoc_cities.SelectedItem.Text & " is SDI - San Diego, which is not covered by Pacific West Association of REALTOR®, please contact us for more information." page1_btn.Visible = False ElseIf MLSID = "S" Then city_mls_desc.Text = "The MLS system that covers " & outside_assoc_cities.SelectedItem.Text & " is SOCAL MLS - Southern California MLS." page1_btn.Visible = True ElseIf MLSID = "T" Then city_mls_desc.Text = "The MLS system that covers " & outside_assoc_cities.SelectedItem.Text & " is Outside Area, which is not covered by Pacific West Association of REALTOR®, please contact us for more information." page1_btn.Visible = False End If 'test.Text = MLSID 'If test.Text = "L" Then 'mls_text.Text = "i-Tech" 'End If End If End If End Sub
Any help would be great, thank you!
View 1 Replies
View Related
Apr 4, 2006
Hello to all
I am having a SQLDataSource on my web page to connect with database. Now If it generates any error then where to capture that errors ?? Means at which place(which event or any other place) should i write code for handeling errors ???
View 7 Replies
View Related
Apr 12, 2007
Greetings,
When using Inserting event of SqlDataSource ASP.NET gives me an error when I reference InsertParameter by Name
An SqlParameter with ParameterName 'CreatedByEmployeeId' is not contained by this SqlParameterCollection.
However, when I reference parameter by index everything works.
Is this a bug or I'm doing something wrong?
Here's the code:
<asp:SqlDataSource ID="dsRole" runat="server" ConnectionString="<%$ ConnectionStrings:SecurityConnectionString %>" DeleteCommand="spDeleteRole" InsertCommand="spAddRole" SelectCommand="spGetRole" UpdateCommand="spUpdateRole" DeleteCommandType="StoredProcedure" InsertCommandType="StoredProcedure" SelectCommandType="StoredProcedure" UpdateCommandType="StoredProcedure">
<DeleteParameters>
<asp:Parameter Name="RoleId" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="RoleId" Type="Int32" />
<asp:Parameter Name="RoleName" Type="String" />
<asp:Parameter Name="RoleDescription" Type="String" />
<asp:Parameter Name="UpdatedByEmployeeId" Type="Int32" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="RoleName" Type="String" />
<asp:Parameter Name="RoleDescription" Type="String" />
<asp:Parameter Name="CreatedByEmployeeId" Type="Int32" />
</InsertParameters>
<SelectParameters>
<asp:ControlParameter ControlID="GridView1" Name="RoleId" PropertyName="SelectedValue" />
</SelectParameters>
</asp:SqlDataSource>
When using parameter name, I get an error:
Protected Sub dsRole_Inserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles dsRole.Inserting
e.Command.Parameters("CreatedByEmployeeId").Value = Internal.Security.GetEmployeeIdFromCookie(Page.Request.Cookies)
End Sub
When using index instead of name, there's no problem:
Protected Sub dsRole_Inserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceCommandEventArgs) Handles dsRole.Inserting
e.Command.Parameters(2).Value = Internal.Security.GetEmployeeIdFromCookie(Page.Request.Cookies)
End Sub
View 2 Replies
View Related
May 29, 2007
Hi, I have such a problem:I try to update (or insert) a row in my table and i fail althought i,ve read many posts here. I.ve created a button and "on_click" event to this button and want that event to update or insert a record in my table. I wrote: protected void selectButton_Click(object sender, EventArgs e) { String taskID = projectsGridView.SelectedRow.Cells[0].Text; usersSqlDataSource.UpdateCommand = "update [Users] set [TaskID]=@task where [UserID]=1"; usersSqlDataSource.UpdateParameters.Add("task", taskID); usersSqlDataSource.Update(); } The application creates error in the last line of code (usersSqlDataSource.Update();) and i receive such an error:You have specified that your update command compares all values on SqlDataSource 'usersSqlDataSource', but the dictionary passed in for oldValues is empty. Pass in a valid dictionary for update or change your mode to OverwriteChanges. For me it looks like there is a problem while setting parameters. Shall i change some properties of the sqlDataSource or GridView? Please help..
View 2 Replies
View Related
May 29, 2007
I have such a problem:i try to update a row in my table using: protected void selectButton_Click(object sender, EventArgs e) { String taskID = projectsGridView.SelectedRow.Cells[0].Text; usersSqlDataSource.UpdateCommand = "update [Users] set [TaskID]=@task where [UserID]=1"; usersSqlDataSource.UpdateParameters.Add("task", taskID); usersSqlDataSource.Update(); }And i receive error on usersSqlDataSource.Update():You have specified that your update command compares all values on SqlDataSource 'usersSqlDataSource', but the dictionary passed in for oldValues is emptyWhat have i done wrong? Parameter are not set?
View 3 Replies
View Related
Mar 21, 2006
Can anyone help me out with using parameters in my SqlDataSource?
I have my UpdateCommand set as follows:
UpdateCommand="UPDATE Custom_ContainerRequest_ESTWEIGHTS SET WEIGHTRANGES = @WEIGHTRANGES WHERE ESTWEIGHTS_ID = @original_ESTWEIGHTS_ID"
<UpdateParameters> <asp:Parameter Name="WEIGHTRANGES" Type="String" /> <asp:Parameter Name="original_ESTWEIGHTS_ID" Type="Int32" /></UpdateParameters>
And the application is just hanging when I run it. (No error message.)
If, however, I hardcode the values instead of using parameters, it works just fine everytime.
UpdateCommand="UPDATE Custom_ContainerRequest_ESTWEIGHTS SET WEIGHTRANGES = 'test' WHERE ESTWEIGHTS_ID = 1"
So I don't know if it's a single-quote issue, or if there's some other syntax I need, or what. One last note is that this is a DB2 database I'm using. But I'm sure that my connection is valid because I can read and update data...only not using parameters.
Any help is greatly appreciated.
Thanks,Billy
View 2 Replies
View Related
Feb 5, 2007
Hello:I forgot what to do in a case like this. I have a SqlDataSource control within a label and I want to allow auto sorting, but when I click on the sort link the page comes back with:The SqlDataSource control 'sqlViewIncompleteForms' does not have a naming container. Ensure that the control is added to the page before calling DataBind.[HttpException (0x80004005): The SqlDataSource control 'sqlViewIncompleteForms' does not have a naming container. Ensure that the control is added to the page before calling DataBind.] System.Web.UI.WebControls.DataBoundControlHelper.FindControl(Control control, String controlID) +1590679 System.Web.UI.WebControls.ControlParameter.Evaluate(HttpContext context, Control control) +76 System.Web.UI.WebControls.Parameter.UpdateValue(HttpContext context, Control control) +46 System.Web.UI.WebControls.ParameterCollection.UpdateValues(HttpContext context, Control control) +103 System.Web.UI.WebControls.SqlDataSource.LoadCompleteEventHandler(Object sender, EventArgs e) +40 System.EventHandler.Invoke(Object sender, EventArgs e) +0 System.Web.UI.Page.OnLoadComplete(EventArgs e) +2010392 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1209How do I over come this? Do I have to use the find control method on page_load? Here is the code portion .vb<% 'Label which contains the default.aspx home content %><asp:Label ID="recip_home_display" runat="server" Visible="false"> <div align="center" class="HeaderSmall">Incomplete Recip Submissions</div> <asp:GridView ID="RecipStatusGridView" runat="server" AutoGenerateColumns="False" BorderWidth="0px" DataKeyNames="queue_id" DataSourceID="sqlViewIncompleteForms" AllowPaging="True" AllowSorting="True" CellPadding="2" CellSpacing="2" CssClass="TextSmall" HorizontalAlign="Center" Width="500px" Visible="False"> <Columns> <asp:BoundField DataField="queue_id" HeaderText="Incomplete Listings" HtmlEncode="False" InsertVisible="False" ReadOnly="True" SortExpression="queue_id"> <ControlStyle CssClass="LinkNormal" /> <ItemStyle HorizontalAlign="Center" /> <HeaderStyle HorizontalAlign="Center" /> </asp:BoundField> <asp:BoundField DataField="form_type" HeaderText="Listing Type" SortExpression="form_type"> <ItemStyle HorizontalAlign="Center" /> <HeaderStyle HorizontalAlign="Center" /> </asp:BoundField> <asp:BoundField DataField="listing_address" HeaderText="Listing Address" ReadOnly="True" SortExpression="listing_address"> <ItemStyle HorizontalAlign="Center" /> <HeaderStyle HorizontalAlign="Center" /> </asp:BoundField> <asp:BoundField DataField="last_modified_date" DataFormatString="{0:d}" HeaderText="Last Modified" HtmlEncode="False" SortExpression="last_modified_date"> <ItemStyle HorizontalAlign="Center" /> <HeaderStyle HorizontalAlign="Center" /> </asp:BoundField> </Columns> <HeaderStyle BackColor="#5C6F8D" /> <AlternatingRowStyle BackColor="#e9eaf0" /> </asp:GridView> <asp:SqlDataSource ID="sqlViewIncompleteForms" runat="server" ProviderName="System.Data.SqlClient" ConnectionString="<%$ Appsettings:connectionstring %>" SelectCommandType="StoredProcedure" SelectCommand="spGetIncompleteForms"> <SelectParameters> <asp:ControlParameter ControlID="active_member_id" Name="AgentId" /> </SelectParameters></asp:SqlDataSource></asp:Label>
View 1 Replies
View Related
Apr 9, 2007
Procedure or function sp_AddDealer has too many arguments specified.
I am experiencing the 'too many arguments specified' error. I am running on SQL 2005. The Parameters lists on SQL server (when I view a dropdown under the sp name) shows a 'returns integer' (but without the @ the signifies a parameter).I have looked around the forums and haven't seen quite this flavor of this error. My forehead is sore from beating it against the wall... any clue would be appreciated!
The error occurs when I click the 'new' link button, enter some data and then click the update link button after ... BOOM - Procedure or function sp_AddDealer has too many arguments specified.
Thanks!!
Chip Kigar
Here is the stored Procedure:
set ANSI_NULLS ONset QUOTED_IDENTIFIER ONgo
ALTER PROCEDURE [dbo].[sp_AddDealer] @sCarcareSystem varchar(100), @sDealerName varchar(50), @sDealerPhysAddrStreet varchar(200), @sDealerPhysAddrCity varchar(100), @sDealerPhysAddrState varchar(10), @sDealerPhysAddrZip varchar(20), @nReturnCode bigint output, @nReturnId bigint output AS
SET NOCOUNT ON DECLARE @m_nCt bigint SET @nReturnCode = 0 SET @nReturnId = 0
-- VALIDATE IF (@nReturnCode = 0) BEGIN SELECT @m_nCt = COUNT(tblDealers.[_DealerId]) FROM tblDealers WHERE [Dealer Name] = @sDealerName IF (@m_nCt >0) BEGIN SET @nReturnCode = -2000 --'Error for exsiting Dealer' SET @nReturnId = 0 END END
-- PROCESS IF (@nReturnCode = 0) BEGIN SET @nReturnCode = -2 --' Error getting new record id' DECLARE @m_nNewRecId bigint SET @m_nNewRecId = 0 EXEC sp_GetNewRecId @m_nNewRecId output IF (@m_nNewRecId > 0) BEGIN SET @nReturnCode = -1 --'Error adding Dealer' INSERT INTO tblDealers ( [_DealerId], [Carcare System], [Dealer Name], [Dealer Phys Addr Street], [Dealer Phys Addr City], [Dealer Phys Addr State], [Dealer Phys Addr Zip] ) VALUES ( @m_nNewRecId, @sCarcareSystem, @sDealerName, @sDealerPhysAddrStreet, @sDealerPhysAddrCity, @sDealerPhysAddrState, @sDealerPhysAddrZip ) SET @nReturnCode = 0 --'Success' SET @nReturnId = @m_nNewRecId
END END
Here is the SQLDataSource. I plugged the ID parameter, so I got a schema back, but no data.
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" InsertCommand="sp_AddDealer" InsertCommandType="StoredProcedure" SelectCommand="sp_GetDealerByDealerId" SelectCommandType="StoredProcedure"> <SelectParameters> <asp:Parameter DefaultValue="2" Name="nDealerId" Type="Int64" /> <asp:Parameter DefaultValue="" Direction="Output" Name="nReturnCode" Type="Int64" /> <asp:Parameter Direction="Output" Name="nReturnId" Type="Int64" /> </SelectParameters> <InsertParameters> <asp:Parameter Name="sCarcareSystem" Type="String" /> <asp:Parameter Name="sDealerName" Type="String" /> <asp:Parameter Name="sDealerPhysAddrStreet" Type="String" /> <asp:Parameter Name="sDealerPhysAddrCity" Type="String" /> <asp:Parameter Name="sDealerPhysAddrState" Type="String" /> <asp:Parameter Name="sDealerPhysAddrZip" Type="String" /> <asp:Parameter Direction="InputOutput" Name="nReturnCode" Type="Int64" /> <asp:Parameter Direction="InputOutput" Name="nReturnId" Type="Int64" /> </InsertParameters> </asp:SqlDataSource>
Here is the Formview:
<asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1"> <EditItemTemplate> _DealerId: <asp:TextBox ID="_DealerIdTextBox" runat="server" Text='<%# Bind("_DealerId") %>'> </asp:TextBox><br /> Carcare System: <asp:TextBox ID="Carcare_SystemTextBox" runat="server" Text='<%# Bind("[Carcare System]") %>'> </asp:TextBox><br /> Dealer Name: <asp:TextBox ID="Dealer_NameTextBox" runat="server" Text='<%# Bind("[Dealer Name]") %>'> </asp:TextBox><br /> Address Street: <asp:TextBox ID="Address_StreetTextBox" runat="server" Text='<%# Bind("[Address Street]") %>'> </asp:TextBox><br /> Address City: <asp:TextBox ID="Address_CityTextBox" runat="server" Text='<%# Bind("[Address City]") %>'> </asp:TextBox><br /> Address State: <asp:TextBox ID="Address_StateTextBox" runat="server" Text='<%# Bind("[Address State]") %>'> </asp:TextBox><br /> Address Zip: <asp:TextBox ID="Address_ZipTextBox" runat="server" Text='<%# Bind("[Address Zip]") %>'> </asp:TextBox><br /> <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update" Text="Update"> </asp:LinkButton> <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"> </asp:LinkButton> </EditItemTemplate> <InsertItemTemplate> _DealerId: <asp:TextBox ID="_DealerIdTextBox" runat="server" Text='<%# Bind("_DealerId") %>'> </asp:TextBox><br /> Carcare System: <asp:TextBox ID="Carcare_SystemTextBox" runat="server" Text='<%# Bind("[Carcare System]") %>'> </asp:TextBox><br /> Dealer Name: <asp:TextBox ID="Dealer_NameTextBox" runat="server" Text='<%# Bind("[Dealer Name]") %>'> </asp:TextBox><br /> Address Street: <asp:TextBox ID="Address_StreetTextBox" runat="server" Text='<%# Bind("[Address Street]") %>'> </asp:TextBox><br /> Address City: <asp:TextBox ID="Address_CityTextBox" runat="server" Text='<%# Bind("[Address City]") %>'> </asp:TextBox><br /> Address State: <asp:TextBox ID="Address_StateTextBox" runat="server" Text='<%# Bind("[Address State]") %>'> </asp:TextBox><br /> Address Zip: <asp:TextBox ID="Address_ZipTextBox" runat="server" Text='<%# Bind("[Address Zip]") %>'> </asp:TextBox><br /> <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert" Text="Insert"> </asp:LinkButton> <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel"> </asp:LinkButton> </InsertItemTemplate> <ItemTemplate> _DealerId: <asp:Label ID="_DealerIdLabel" runat="server" Text='<%# Bind("_DealerId") %>'> </asp:Label><br /> Carcare System: <asp:Label ID="Carcare_SystemLabel" runat="server" Text='<%# Bind("[Carcare System]") %>'> </asp:Label><br /> Dealer Name: <asp:Label ID="Dealer_NameLabel" runat="server" Text='<%# Bind("[Dealer Name]") %>'> </asp:Label><br /> Address Street: <asp:Label ID="Address_StreetLabel" runat="server" Text='<%# Bind("[Address Street]") %>'> </asp:Label><br /> Address City: <asp:Label ID="Address_CityLabel" runat="server" Text='<%# Bind("[Address City]") %>'> </asp:Label><br /> Address State: <asp:Label ID="Address_StateLabel" runat="server" Text='<%# Bind("[Address State]") %>'> </asp:Label><br /> Address Zip: <asp:Label ID="Address_ZipLabel" runat="server" Text='<%# Bind("[Address Zip]") %>'> </asp:Label><br /> <asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New" Text="New"> </asp:LinkButton> </ItemTemplate> </asp:FormView>
View 4 Replies
View Related
Feb 9, 2006
I have a database with columnsuserOwnListsuserID uniqueidentifieruserName nvarchar100userList nvrachar100createdDateI
have created successfully a gridview controller to edit these values in
database. The Gridview data is populated by SqlDataSource.I
have also created a EmptyDataTemplate and created a form into it.
There is only one textBox and submit button to create the First entry
to userOwnLists -table.Now I collect the value from EmptyDataTemplate textbox with id userList1 and create a codebehind logic for the submitbutton.protected void Button2_Click(object sender, EventArgs e) { TextBox listName = (TextBox)this.FindControl("listName1", GridView1.Controls);SqlDataSource1.InsertParameters["userId"].DefaultValue = Membership.GetUser().ProviderUserKey; SqlDataSource1.InsertParameters["userName"].DefaultValue = Membership.GetUser().UserName.ToString(); SqlDataSource1.InsertParameters["listName"].DefaultValue = listName.Text; SqlDataSource1.InsertParameters["createdDate"].DefaultValue = DateTime.Now.ToString(); SqlDataSource1.Insert(); }The problem is now that I get error: Exception Details: System.Data.SqlClient.SqlException:
Implicit conversion from data type sql_variant to uniqueidentifier is
not allowed. Use the CONVERT function to run this query.OK. So I Googled a bit and found this:http://scottonwriting.net/sowblog/posts/4690.aspxMy Question is: How do I convert userId so I can insert it to database successfully?This does not work:String userId = Membership.GetUser().ProviderUserKey.ToString(); SqlDataSource1.InsertParameters["userId"].DefaultValue = Convert.ToString(userId);
View 2 Replies
View Related
May 19, 2006
I had just installed SQL 2005 dev on my laptop and got an error message when I tried to create a package using the BI IDE. I received the same error using VS2005 IDE. But the project was created regardless without any packages. When I tried to create a new package in the project, I received the same error again, but with an option to view the error details.
Following is the text of the error details:
TITLE: Microsoft Visual Studio
------------------------------
Error creating package
------------------------------
ADDITIONAL INFORMATION:
Failed to save package file "C:Documents and SettingsmyoungbloodLocal SettingsTemp mpD4B.tmp" with error 0x80040154 "Class not registered".
------------------------------
Failed to save package file "C:Documents and SettingsmyoungbloodLocal SettingsTemp mpD4B.tmp" with error 0x80040154 "Class not registered".
------------------------------
BUTTONS:
OK
------------------------------
I found a similar post that suggested that they try the following:
regsvr32 msxml3.dll
regsvr32 msxml4.dll
regsvr32 msxml6.dll
But msxml6.dll could not be found.
I did get a copy of this file from a coworker, and after copying it and registering it, I was able to add a package to the project.
My concern now is what is the likelyhood of this being the only file missing from the installation.
I'm wondering if I should reinstall, or (if it exists) do a repair on the installation.
Thanks.
Marshall
View 12 Replies
View Related
Jul 23, 2007
What is the C# code I use to do this?
I'm guessing it should be fairly simple, as there is only one row selected. I just need to pull out a specific field from that row and then insert that value into a different SqlDataSource.
View 7 Replies
View Related
Sep 11, 2006
Hi:
I am trying to create a CLR UDF in SQL 2005 and cosnistently run into the following error. What am I doing wrong?. Please correct me and show me the right way of doing this.
Msg 6551, Level 16, State 2, Procedure EmailSplitter, Line 3
CREATE FUNCTION for "EmailSplitter" failed because T-SQL and CLR types for return value do not match.
Here is what I am trying to achieve. Split a Email field in the database. For that I am trying to return an array using C# and then trying to call the UDF for the C#.
--1).CLR Code. (EmailSpitter.cs)
using System;
using System.Collections.Generic;
using System.Text;
namespace SQLTools
{
public class EmailSplitter
{
public static string[] Parse(string data)
{
string[] columnData;
string[] separators = new string[1];
separators[0] = " ";
if (data != null)
{
columnData = data.Split(separators, StringSplitOptions.None);
return columnData;
}
return null;
}
}
}
--2). Assembly code.
CREATE Assembly SQLArrayBuilder
FROM 'E:CLREmailSplitterinDebugEmailSplitter.dll'
WITH PERMISSION_SET=SAFE
Select * from sys.assemblies.
--3). Create the function.
CREATE Function dbo.EmailSplitter
(@EmailString NVARCHAR(4000))
RETURNS VARCHAR(4000)
AS
EXTERNAL NAME SQLArrayBuilder.[SQLTools.EmailSplitter].Parse
Run into the error:
Msg 6551, Level 16, State 2, Procedure EmailSplitter, Line 3
CREATE FUNCTION for "EmailSplitter" failed because T-SQL and CLR types for return value do not match.
Please help me.
Thank you very much.
AK
View 1 Replies
View Related
Aug 13, 2007
This has got to be simple... Every time I try to create this sproc I get the following error:
Msg 156, Level 15, State 1, Procedure sp_AddTradeItemsToSelections, Line 5
Incorrect syntax near the keyword 'VIEW'.
Its driving me nuts because I can't see anything wrong with line 5 where the view is being created. CREATE PROCEDURE [dbo].[sp_XXXXX]
@UserdataIDInt,
@BuilderIDInt
AS
CREATE VIEW TradeItem_Append
AS
SELECT TradeItemID, UserDataID, BuilderID
FROM Selections
WHERE (UserDataID = @UserdataID)
SELECT TradeItem_Append.UserDataID, TradeItems.BuilderID, TradeItems.TradeID, TradeItems.TradeItem, TradeItems.Price, TradeItems.DDLRefNo,
TradeItems.TradeItemID, TradeItems.Details, TradeItems.ProductType, TradeItems.Room, TradeItems.Notes
FROM TradeItems LEFT OUTER JOIN
TradeItem_Append ON TradeItem_Append.TradeItemID = TradeItems.TradeItemID
WHERE (TradeItem_Append.TradeItemID IS NULL)AND(TradeItems.BuilderID = @BuilderID)
DROP VIEW TradeItem_Append
View 7 Replies
View Related
May 20, 2004
im creating a ecommerce website, and i need to create a database, im using visual studio .net
and when i try to create a new database using VS.net i choose "use sql server authentication" and no matter what i type in for the login id, i get the following ado error
"ADO Error : ' Login failed for user "blank". Reason. Not associated with a trusted SQL server connection.'
thanks in advance.
View 4 Replies
View Related
Sep 6, 2005
Hi,
When I try to create a CLR function in SQL 2005 (June CTP) I get the following error:
Msg 6505, Level 16, State 1, Procedure Extenso, Line 1Could not find Type 'Extenso' in assembly 'ExtensoNET'.
The assembly registers successfully, with no errors.
I use the following command to create the function:CREATE FUNCTION Extenso (@Valor float)RETURNS VARCHAR(255)AS EXTERNAL NAME ExtensoNET.Extenso.EscreveExtensoGO
The function's code is the following:
using System;using System.Collections.Generic;using System.Text;using Microsoft.SqlServer.Server;using System.Data.SqlClient;
namespace ExtensoNET{ public class Extenso { [SqlFunction(DataAccess = DataAccessKind.Read)] public static string EscreveExtenso(double? nValor) {
//Valida Argumento if (nValor==null || nValor <= 0 || nValor > 999999999.99) return "";
//Variáveis int nTamanho; string cValor, cParte, cFinal; string[] aGrupo = { "", "", "", "", "" }; string[] aTexto = { "", "", "", "", "" }; . . . }
return cFinal;
} }}
Thanks in advance,
Anderson
View 1 Replies
View Related
Mar 20, 2001
Hi
I have a Win2K SP1 server running SQL 7. Whenever I try to create a DTS package, I get a box headed "DTS CoCreateInstance" with "Error in the DLL" as the box text. I have tried removing and re-installing SQL 7 and have also applied SQL SP 1,2 & 3. There are no errors in the event log, just the popup error outlined above.
Has anyone seen this error, and is there a fix?
Thanks
Simon Thomas
CommArc Consulting Ltd
View 1 Replies
View Related
Aug 11, 2000
Hi,
I don't see what's wrong with this command.
>>
Create View BCPOutBatchWeightTaiwan AS
Select *
from batchWeight a JOIN Geography b
ON a.GeographyPtr = b.GeographyPtr
where b.countrycode = 'tw'
<<
I get the following error if I try to create it.
>>
Server: Msg 4506, Level 16, State 1, Procedure BCPOutBatchWeightTaiwan, Line 2
Column names in each view must be unique. Column name 'GeographyPTR' in view 'BCPOutBatchWeightTaiwan' is specified more than once.
<<
But it runs fine if I run only th 'Select' part of the command
without 'CREATE' line.
Any help is appreciated.
Thanks.
Ranjit
View 1 Replies
View Related
Apr 12, 2007
I am trying to create an assembly on a sql server 2005 machine but it gives me following error:
Msg 33009, Level 16, State 2, Line 2
The database owner SID recorded in the master database differs from the database owner SID recorded in database 'XYZ'. You should correct this situation by resetting the owner of database 'XYZ' using the ALTER AUTHORIZATION statement.
I tried using the alter authorization statement to change the owner.
It did not work.
I am able to create same assembly on another test database but can not create it on this database.
Is this because of orphan logins?
Thanks for the help.
Harshal.
View 4 Replies
View Related
Dec 5, 2006
hi,
i want to create table using another table but i am getting the following error.
Server: Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'AS'.
my query is:
CREATE TABLE errorlog
AS SELECT * FROM log where 1=0
becos i a trying to copy the structure of the table log to table errorlog.please rectify my problem,please
View 4 Replies
View Related
Apr 3, 2007
We upgraded from SQL Server 2000 to 2005 recently. I'm attempting to create a credential for the first time and I keep getting the error shown below. Can anyone tell me what to do to resolve it? Thank You
TITLE: Microsoft SQL Server Management Studio
------------------------------
Create failed for Credential 'schjob'. (Microsoft.SqlServer.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.3042.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+Credential&LinkId=20476
------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
An error occurred during decryption. (Microsoft SQL Server, Error: 15466)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.3042&EvtSrc=MSSQLServer&EvtID=15466&LinkId=20476
------------------------------
BUTTONS:
OK
------------------------------
rm
View 2 Replies
View Related
Apr 12, 2007
I am trying to create an assembly on a sql server 2005 machine but it gives me following error:
Msg 33009, Level 16, State 2, Line 2
The database owner SID recorded in the master database differs from the database owner SID recorded in database 'XYZ'. You should correct this situation by resetting the owner of database 'XYZ' using the ALTER AUTHORIZATION statement.
I tried using the alter authorization statement to change the owner.
It did not work.
The same assembly is created on another test database but can not create it on this database.
Is this because of orphan logins?
Thanks for the help.
Harshal.
View 6 Replies
View Related
Apr 24, 2007
What is wrong with the following command?
create database SuppliersDatabase
create table tblWarrantyClause(
WarrantyID int,
Warranty char(100),
WarrantyPeriod int,
Coverage char(100),
ReplacementPeriod int,
ReplacementPeriodUnit char(50),
DocRef char(100),
ReferencePage char(10),
ReferenceSection char(10),
ContractID_fk int );
I just wondering where can I find the table of my database SuplliersDatabase. I need to know if it is already exists or not? I tried to look around but then still I can't find it.
===============
JSC0624
===============
View 9 Replies
View Related
Jul 25, 2007
i tried running the statement :
(1)
create view qcostcentre
as
select * from dbo.costcentre.dtblcostcentre
>ERR: Msg 208, Level 16, State 1, Procedure qcostcentre, Line 4
Invalid object name 'dbo.costcentre.dtblcostcentre'.
(2)
create view qcostcentre
as
select * from costcentre.pcusers.dbo.dtblcostcentre
>ERR: Msg 7202, Level 11, State 2, Procedure qcostcentre, Line 4
Could not find server 'costcentre' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers.
note: pcusers is a user of 2 database (costcentre & datamaster) with dbo_datareader owned & role schema .
View 3 Replies
View Related
Jun 1, 2007
Hi all,
When ever i tried to creat a diagram for the database i have i got this error:
Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database diagram support objects.
the version of the database i am working in was backed up from another machine
what is the problem and how can i solve it?
Thanks in advance
View 3 Replies
View Related
Nov 8, 2006
On screen states [Error loading mining model metadata: No Metadata found]
and on the functions states [Error loading functions: no functions found]
This also occures when trying to use the Data mining wizard, it will just not respond.
Have deleted and removed all references to SQL2005 Standard and reloaded and still get same errors
Could someone please advise, have sent errors to Microsoft with no responce back yet.
View 1 Replies
View Related