VWD 2005 Express. Visual Basic. SQL Server 2005. I have a gridview tied to a sqldatasource. If there have been changes made to the records of the sqldatasource, does a sqldatasource.databind have the effect of requerying the database? Is this the proper method to use if I want to requery/update the gridview form?
Hey guys, how can I databind a default value for my textbox in the <InsertItemTemplate>I tried an Eval but it obviously didnt't work. The data source has a Selectcommand with ID that I thought I could use in the insertitem, but i guess not.<asp:FormView ID="FormView2" DataSourceID="SqlDataSource1" runat="server"> <InsertItemTemplate> Test<br /> <asp:TextBox ID="abc" runat="server" Text='<%# Eval("ID") %>' /> </InsertItemTemplate></asp:FormView>How can I do this?thanks
Hey everyone,I've got a problem and I can't tell if it's in the stored procedure I'm calling, or it's with the Binding it to the datalist.The error is Syntax error converting datetime from character string.The code it crashes on is:Line 100: //Bind data Line 101: dg_details.DataSource = reader; Line 102: dg_details.DataBind(); Line 103: dg_details.Visible = true; and my store procedure I'm calling is: ALTER PROCEDURE coglej.GetEventsForDate @eventdate datetime, @eventowner varchar (50)
AS
IF DATEDIFF(ww,GetDate(),@eventdate ) > 2 BEGIN PRINT 'Getting EB event price.' SELECT dbo.events.event_date, dbo.locations.city, dbo.locations.state, dbo.locations.name, dbo.locations.address1, dbo.locations.address2, dbo.locations.zip, dbo.skus.sku_id, dbo.skus.event_type, dbo.skus.price, dbo.skus.slots_available FROM dbo.events INNER JOIN dbo.locations ON dbo.events.location_id = dbo.locations.location_id INNER JOIN dbo.skus ON dbo.events.sku_id = dbo.skus.sku_id WHERE (dbo.events.event_date = CONVERT(datetime, '@eventdate')) AND (dbo.skus.owner = @eventowner) AND (dbo.skus.price_type = 'Early')
END ELSE BEGIN PRINT 'Getting regular event price.' SELECT dbo.events.event_date, dbo.locations.city, dbo.locations.state, dbo.locations.name, dbo.locations.address1, dbo.locations.address2, dbo.locations.zip, dbo.skus.sku_id, dbo.skus.event_type, dbo.skus.price, dbo.skus.slots_available FROM dbo.events INNER JOIN dbo.locations ON dbo.events.location_id = dbo.locations.location_id INNER JOIN dbo.skus ON dbo.events.sku_id = dbo.skus.sku_id WHERE (dbo.events.event_date = CONVERT(datetime, '@eventdate')) AND (dbo.skus.owner = '@eventowner') AND (dbo.skus.price_type = 'Regular')
ENDWhat's cause the crash are the quotes around @eventdate. However, without them, it doesn't return all the rows (if any) and if I have them in, I get this error. The odd thing is that when I copy and paste one of the SELECT statements into the VWD sql window and replace the variables with the same values I'm using at runtime, everything runs fine.Anyone have any ideas?Thanks in advance,--Joel
I want to databind the gridview to the "aspnet_Users" that table to view and edit the data, but when I configure the Datasource in the gridview, I could not find that table, the gridview only show the vw_aspnet_Users that view. I don't know what the problem is?
Hi,I've never used an SQLDataSource programatically before.Its not even executing the select command because I've got a trace on the database and theres no executing of the Sproc.Here's my code behind: Dim sql As New SqlDataSource sql.ConnectionString = ConfigurationManager.ConnectionStrings("My connection").ConnectionString sql.SelectCommand = "Select_All" sql.SelectCommandType = SqlDataSourceCommandType.StoredProcedure sql.SelectParameters.Add("@Param1", txtParam1.Text) sql.SelectParameters.Add("@Param2", txtParam2.Text) sql.DataSourceMode = SqlDataSourceMode.DataReader gvOrderItemsReport.DataSource = sql gvOrderItemsReport.DataBind() Any ideas? I must be missing something.
I working on a form using an SQL DataSource. I am going to add a where clause. In that where clause a value from a label will be passed from the user. How do I pass to the HTML Source the label value from the where clause. The value can change from user to user. Sample below: SELECT [KeyRolesID], [KeyRolesDesc] FROM [KeyRoles] WHERE ([JobCodeFamily] = @JobCodeFamily). I want to replace the @JobCodeFamily which is currently coded with a value from the Sql DataSource in the design form with a label value entered by the user.
but it doesn't work, I tried use a pure asp.net web service and it works. can anyone help me to set the connecting string for datasource and query for dataset when it using wcf as the web service? Thanks in advance.
I have a question about the datasource that we create on the Report Manager. What is it used for? In the below connection string which is given in the "Connection String" text box of a datasource link:
What is this datasource used for? Is it used only to use the ReportServer database or even our queries incorporated in the RDL files will be run against this datasource? I think the latter should not happen because while creating RDL files also, we provide a connection string to run the stored procedures against that datasource.
Please let me know about the same.
Thanks a lot and let me know if the question is not clear.
I have this web store that I have been creating. When a customer goes to check out, he has to log in, then he is redirected to a page where he can view/add/or edit shipping and billing address. I have based all the sql statements on the profile username, adding records and retrieving them works just fine. When I go to change something in the info it uses an sql statement that updates based on "Where AccountUserName = @AccountUserName", I have @AccountUserName set to Profile("Username"). Keep in mind this works fine for adding new or bring up current records. I even put in code in the updated event for the sql data source to post a msgbox telling me how many rows were affected, it says 1 even though I dont see any change in the data. What am I doing wrong here, it's driving me nuts, its just a very simple update.
My god.All I want to do is post the contents of a web form to a database sql express 2005 or access using C#. Why can I find nothing for this very simple process online?Can you tell I am totally frustrated? So lets say i have a few text fields and I want to click submit and have that entered into a table. I use C# for code behind. So I can do basic C# programming and I can to webforms with visual web developer 2005 dragging and dropping for textboxs and a button to the aspx page. But then the mystery begins for me. How the hell do I simple post that form data to the table. I understand connection string basics. I aslo can design and create tables. But tying this all together is becoming a problem. I don't want to use gridview formview detailview or any of that canned UI stuff. I also don't understand VB and when I see VB examples they only cloud my already cloud ASP.NET world. Please help by posting examples, and maybe some links or books to add to my newbish collection. Thanks,Frank
Lets say I have a Sqldatasource that uses the following SelectCommand="SELECT category,name FROM table". How do I get the value on category from my datasource in code behind if I know that my selectcommand always will return one row? Can I write something like datasource.items["category"].Value? Thanks for your help!
Hi there, I'm using a Repeater at the moment which is bound to a SQLDataSource. I expect much load on that Website, should I choose another DataSource? Which other DataSource is better if it's about Performance? I read some stuff about the SQLAdapter and a DataSet.. is that better in performance? Why is it better? What about LinQ? Thanks a lot for any clarification.
I am using a SQLDatasource to populate a dataview as illustrated below. I run into a problem when I search for a "LastName" that includes an (') Apostrophe ( e.g. O'Reilly) . Searchin for the whole name there is no problem, but when I search for simply O, or O' I get errors. I am not sure ...when to address names with an apostrophe... 1) On insertion to the database (using a "Replace(LastName, "'", "''") 2) or after they have been entered and they are to be searched for. If scenario 1, can anyone provide the best way to do this...If scenario 2, how would that be worked into the SQL Datasource code below.... I have tried several variations with the times SQL Datasource to no avail.... I would appreciate any help ! Thanks ! <asp:SqlDataSource ID="SqlDataSource1" runat="server"ConnectionString="<%$ ConnectionStrings:ClinicTest2ConnectionString1 %>" SelectCommand="SELECT [PatientID], [Accession], [FirstName], [LastName], [Address1], [City], [strddlPatientState], [ZIP], [DOB] FROM [ClinicalPatient] WHERE [LastName] LIKE @LastName ORDER BY [LastName],[FirstName]ASC">
I have a single variable to be utilitized in my SQL Where clause... Select *FROM projectsWhere project_id = @id How do I use this c# variable in the datasource? string TableID; TableID = "192.AB"; I know this is simple, but I figured I'd ask. I don't want to do a work around , like a hidden textbox with the value assigned, and then link the datasource to the tb control, seems extremely hackish.
Hi When I try to configure a SQL datasource and I use a Microsoft SQL Server datasource I get a blank drop down list for server name. My aspnetdb is available in SQL Server 2005 and I can log into it through management studio, and the service is started. I am also using Vista Ultimate. Is there any other configuration I need to do for Visual Studio 2008 to see the SQL Server instance? Thanks Kwis
hi... i am very new to SQL server.. previously was using MySQL... now i am trying to connect my project to SQL Server.. but i wasnt able to... i keep getting errors
System.Data.Odbc.OdbcException: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified at System.Data.Odbc.OdbcConnection.Open() at icms.DB.q(String mySTR) in C:icmsDB.vb:line 30
below is my webconfig i am not very sure about the value for the user.. because if it is MySQL i can get it from my control centre.. but what about SQL server ? where should i get my value ?
Dim myCMD As New SqlCommand Public Sub New() Dim db_server = AppSettings("db_server") Dim db = AppSettings("db") Dim db_user = AppSettings("db_user") Dim db_pwd = AppSettings("db_pwd") Dim DBConnection As String = "DRIVER={SQL Server};" & _ '<==== is my driver correct? "SERVER=" & db_server & ";" & _ "DATABASE=" & db & ";" & _ "UID=" & db_user & ";" & _ "PASSWORD=" & db_pwd & ";" & _ "OPTION=3;" myDB.ConnectionString = DBConnection myCMD.Connection = myDB End Sub 'Public Function q(ByVal mySTR As String) As OdbcDataReader 'SQL Query Public Function q(ByVal myStr As String) As SqlDataReader myCMD.CommandText = myStr Try myDB.Open() q = myCMD.ExecuteReader(Data.CommandBehavior.CloseConnection) Catch ex As Exception Err(ex.ToString) End Try
End Function Public Sub c(ByVal mySTR As String) ' COMMAND ONLY Try myCMD.Connection.Open() myCMD.CommandText = mySTR myCMD.ExecuteNonQuery() myCMD.Connection.Close() Catch ex As Exception Err(ex.ToString) End Try End Sub
If I add this to my web config ConnectionStrings section:<add name="SQLPubs" connectionString="myServer99;uid=MyUId;pwd=MyPWD;database=MyDB" providerName="System.Data.SqlClient" />Everything displays correctly, referring to this section in the SQLDataSource ControlHowever, if I add the connection string, exactly as it's listed in the web.config, and INSTEAD of the using that entry, enter it implicitly in the Connectionstring property of the DataSource Control, along with adding the System.Data.SQLClient to the ProviderName property of the DataSource control (which I understood was possible), I get this error:Unable to find the requested .Net Framework Data Provider. It may not be installedWhat am I missing?here's my tag:<asp:SQLDataSource ID="DS1" Runat="Server" SelectCommand = "SELECT top 50 {FieldList}From {TableName}" ConnectionString="myServer99;uid=MyUId;pwd=MyPWD;database=MyDB" ProviderName="System.Data.SQLClient"></asp:SQLDataSource>
im using this datasource to extract values from a database.i simply want to extract the values for ratingsum and ratingcount to populate variables so as to be checked within a code loop.how do i do this? in classis asp would be something like <%=rsRecords(RatingSum)%><asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MyConnectionString %>" ProviderName="<%$ ConnectionStrings:MyConnectionString.ProviderName %>" SelectCommand="SELECT SUM(rating) As RatingSum, COUNT(*) As RatingCount FROM tbl_Rating WHERE Itemid=100"> </asp:SqlDataSource>
I have a simple form that accepts a zip code and a city when the submit button is hit this is triggered... Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click Dim Zip, City As String Zip = txtZip.Text City = txtCity.Text grdZipCodes.DataSourceID = "ZipSearch" ZipSearch.SelectParameters("ZipCode").DefaultValue = Zip ZipSearch.SelectParameters("City").DefaultValue = City grdZipCodes.DataBind() End Sub This is supposed to populate a gridview with filtered data. Instead I get nothing, even though in query analyzer if I dont provide a city or a state all results are returned. Is there a reason my gridview is not populating.
New to databases so need some help. While trying to set up data source in control panel, I find that there are no drivers for *mdf files. Just *.dbo and *.xls and others. Can someone tell me what to do. I can't get analysis services to let me access my database, which are *mdf files a friend sent me.
I am trying to do incremental extract using Datasource reader. I need to send a variable in where condition to extract the data base on the max date from other table.
To implement this i have created two variables 1)to get the max date from the table. 2)to store the sql query and send the mad date from other variable to extract the data.
i have give this sql variable in data flow expression.but its not working.
I am using SSRS 2005 (Report Designer), and in 1 of the Report, I have a Report Parameter for example say IMask (Dropdown List), which I am populating by values from the following XML file (Imask.xml)
2) If no nodes(<INVALIDMASK>) are present in the XML file, I get no results when the above XML query is fired. So, Is there any way of getting the count of rows returned by XML query. And in case of no rows I want my Report Parameter (IMask) to have €śvalue field€?= NONE and €ślabel field€?= NONE
I create a datagrid and bind a datasource to it. now, i want to know how do one add new rows to the data source, so in the datagrid, i can add new rows and how to provide autonumbering.
I have two projects inside my solution - a windows project and a reporting services project. I am using my business logic class as my datasource which includes the objects I want to wire up to my reports. Is there anyway to specify that I want to use these objects from my windows project rather than creating a new sharing datasource inside the RS project?
So I'm trying to run through a directory of reports and change the data source of every report from whatever it has now, to a shared data source. I'm using C#.
If I understand the process correctly, I want to .GetItemDataSources on the reports service and store it in an array of datasources. Then I want to Change the name and reference of the datasource to match something that I alredy have elsewhere. Here is the code...
System.Web.Services.Protocols.SoapException: The data source 'SummerOf70' cannot be found. ---> Microsoft.ReportingServices.Diagnostics.Utilities.DataSourceNotFoundException: The data source 'SummerOf70' cannot be found. at Microsoft.ReportingServices.DataExtensions.DataSourceInfoCollection.CombineOnSetDataSources(DataSourceInfoCollection newDataSources) at Microsoft.ReportingServices.Library.SetItemDataSourcesAction.SetReportDataSources(CatalogItem item, DataSource[] dataSources) at Microsoft.ReportingServices.Library.SetItemDataSourcesAction.PerformActionNow() at Microsoft.ReportingServices.Library.RSSoapAction`1.Execute() at Microsoft.ReportingServices.WebServer.ReportingService2005Impl.SetItemDataSources(String Item, DataSource[] DataSources) --- End of inner exception stack trace --- at Microsoft.ReportingServices.WebServer.ReportingService2005Impl.SetItemDataSources(String Item, DataSource[] DataSources) at Microsoft.ReportingServices.WebServer.ReportingService2005.SetItemDataSources(String Item, DataSource[] DataSources)
I know the DataSource is there.
Am I going about this all wrong? Should I delete the datasource first and then create a new one?
I look forward to clarifying my poor grammar. Thanks in advance!
OK I am a newbie when it comes to lots of .Net so if you answer go slowwww. I have an auto incrementing ID field in a SQL database.This is all displayed to the user in a datagrid control. I add two or three new rows and AcceptChanges.At this point I my ID field displayed on the grid bound tot he SQL ID field is out of Sync. What the #@^%#$&* In fact it looks like the data grid placed in its own numbers by doing some sort of Maxvalue on the column. HELP! Bob
Hi , I am trying to write a report generator by simply using a form and then a gridview that query's the database based on what the user selects on the form. Anyways, I update the SQL parameters similar to below code. I just want to know how i can tell the parameter to get ALL values from the parameter instead of a specific value. For example if the user wanted to see ALL the records for CustomerName what would i set the parameter default value to? I tried the asterisk but that did not work. Please guide me....Thanks! MattSqlDataSource1.SelectParameters["CustomerName"].DefaultValue = "some value";<asp:SqlDataSource ... > <SelectParameters> <asp:Parameter Name="CustomerName" /> </SelectParameters></asp:SqlDataSource>