Hi ,Have a Visual C++ app that use odbc to access sql server database.Doing a select to get value of binary field and bind a char to thatfield as follows , field in database in binary(16)char lpResourceID[32+1];rc = SQLBindCol(hstmt, 1, SQL_C_CHAR,&lpResourceID,RESOURCE_ID_LEN_PLUS_NULL , &nLen1);and this works fine , however trying to move codebase to UNICODE antested the followingWCHAR lpResourceID[32+1];rc = SQLBindCol(hstmt, 1, SQL_W_CHAR,&lpResourceID,RESOURCE_ID_LEN_PLUS_NULL , &nLen1);but only returns 1/2 the data .Any ideas , thoughts this would work fine , nit sure why loosing dataAll ideas welcome.JOhn
My task is to add income by taking few variables from webpage. I had take User ID(From database), Field value by selecting it from DropDownBox( Which value is once again taken from database), Income Description, Date, Amount . I had completed this task successfully by binding DropDownBox to database by query string and added income using stored procedure as below.
I need this to be done using only single Stored Procedure for binding Field Value to DropDownBox and for adding income. Plz tell me how to do this? ASPX.CS file protected void Page_Load(object sender, EventArgs e) { SqlConnection con = null;
con = DataBaseConnection.GetConnection(); DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter("select PA_IFName from PA_IncomeFields where PA_UID=@PA_UID", con); da.SelectCommand.Parameters.Add("@PA_UID", SqlDbType.Int).Value = (int)Session["PA_UID"]; da.Fill(ds);
I have a report which displays a customers invoice, in both the companys local currency, and the customers local currency.
The report language is "English (United Kingdom)" The fields showing customers currency language setting is set to something else, i.e. "France (French)" to display the Euro currency.
The application handles 34 currencies, the query returns the language string, ("France (French)"), to allow the report to bind its language setting to the querys output.
However, it doesn't work, a normal textbox will display the correct country name string, but Reporting Services cannot bind the language setting to a query result. So I also tried setting it as a report parameter, but no joy either (all currencys revert to USD).
I'm using =First(Fields!curFormat.Value, "myDataSet") to bind the 'language' setting, the result of this expression returns "France (French)", which is a valid option for this language setting, as it's in the drop down list.
Rather than create 34 seperate reports for each currency, are there any suggestions on how to bind a fields language setting to a query result?
I used a binding source in my script task codes to filter the data table. when i used that, even if i declare it (dim bs as bindingsource), i'm still having an error - "type bindingsource is not defined".
I have an updateable and sensitive SqlCeResultSet that is bound to a DataGrid via a BindingSource. All updates to the resultset are programmatic. Changes to an existing record in the resultset are visible in the DataGrid and I am getting corresponding ListChanged events fired from the BindingSource. When I perform an database update independent of the resultset that changes resultset membership, I can peform a ReadLast and see the additional records; however the ListChanged event does not fire. Also, when I explicitly "create" a new record in the resultset I do not get a ListChanged event and in both cases the DataGrid does not display the records. Re-binding to the existing resultset does not appear to work either. Only when I create a new resultset and bind do the new or records display. Using Compact Framework 2.0.
All - I'm having some trouble, and I hope someone can give me some assistance. I've scoured Google, and have only found stuff similar to what I already have.
My company has an old commercial ERP package. The package has a table called 'Lot_Bin_Tran' that tracks movements of parts based on the part number and a 'Tran_code' - a one-character field that represents what kind of transaction it is (receipt, shipment, inventory adjustment, etc...). Using those two pieces of information, you can join this single table to any of the tables that hold the information (such as receipts). I tried to write a left join from my transaction table to my primary tables to look for transaction records that have no corresponding records in the primary tables. Some SQL might be helpful here...
Code:
SELECTLBT.* FROMLOT_BIN_TRANLBT(NOLOCK), PRODUCEP(NOLOCK), ORDERSO(NOLOCK), ISSUESI(NOLOCK), RECEIPTSR(NOLOCK), LOT_BIN_XFERLBX(NOLOCK) WHERELBT.PART_NO = 'OUR_PART_NUMBER_GOES_HERE' AND LBT.TRAN_NO *= CASE LBT.TRAN_CODE WHEN 'I' THEN I.issue_no WHEN 'P' THEN P.prod_no WHEN 'R' THEN R.receipt_no WHEN 'S' THEN O.order_no WHEN 'T' THEN LBX.tran_NO END AND ((I.ISSUE_NO IS NULL) AND (P.PROD_NO IS NULL) AND (R.RECEIPT_NO IS NULL) AND (O.ORDER_NO IS NULL) AND (LBX.TRAN_NO IS NULL))
when I run this, though - I get the following message... Quote: Msg 301, Level 16, State 1 Query contains an illegal outer-join request.
If I change the Left join to an inner join (using = instead of *=), I get a resultset, but not the one I want (since I can't detect nulls in all tables using inner join). Any ideas on how I can restructure?
Hi. This SHOULD be something simple, but I am apparently missing something. I have a Users table where a user's status is a varchar(100). I'm trying to implement a trigger so that when a user's status is changed to any string other than what it was before the update the trigger would change the LastUpdated field to current date/time.
Here's the trigger, I replaced the update of LastUpdated with a simple print statement. For some reason, it seems like the trigger is firing after the update statement has committed because the values of @m_status_new and @m_status_old are always the same so this trigger always prints 'status has not changed.' What am I doing wrong? Thank you greatly for any help provided.
USE myDB IF EXISTS (SELECT name FROM sysobjects WHERE name = 'tr_update_users' AND type = 'TR') DROP TRIGGER tr_update_users GO
CREATE TRIGGER tr_update_users on dbo.Users FOR UPDATE AS
DECLARE @m_status_new varchar(100), @m_status_old varchar(100), @m_UserID int
I am sending variables from package to package by configuration parent packages in each package... I usually set logging to text files in a certain path that should be received from the parent variable... the strange thing is that if i let the variable in the child package with an incorrect path, my package just through an error even if i am passing the variable from the parent with a correct value...
So... my question is... does my package starts execution without any synch over the parent packages? When are they set? How can i be sure to start my logging with the right parent variable settings?
You can try for example to create a package... add a new variable like "A" and "B" set its value to a default string like "I DONT WANT THIS", add an Execute SQL Task that will record the values of "A" variable to a temporary table... Then use dtexecui.exe to execute the package and set variable "A" to "THIS IS WHAT I NEED" you will see that in the table will appear one record with the "I DONT WANT THIS" value...
I can't understand this...
Also... if i have 100 variables configured to get values from the parent... is the execution synch or asynch?
Hi,Sorry for the obscure title but I'm afraid I can't think of a betterway to describe what happened to one of my clerks last night. The guy wasworking late, made a series of changes (accross a number of tables with adependant relationship structure - i.e. a customer linked to an order linkedto an invoice linked to a payments etc.) Now when he came back this morningnone of the work he did last night was still there. I'm by no means asql-pro - but I've managed to make do so far. Here's what I know:1) All of our records in all of our tables have date/time stamped. Once whenthey go in and once when they're changed. So with a little work I can buildup a good picture of what usage our database gets at what times. I've pulledup a query and there is a big fat hole between 8pm-10pm - stuff thathappened before that is still there, stuff that happened after that is stillthere - but all the changes that were put in between then just aren't thereany more. So it's not just insertions but updates as well.2) There is no perceivable break in our identity columns. So despite thefact that I know he entered 7 new customers, I can go back through thecustomers table and look at where those customers should sit visa vie entrytimes - and it's just as though the customers he entered never existed -sql server just keeps incrementing sequentially and there's no break - sothe last customer entered at about 6:50 pm was something like number 11912and the customers entered this morning have numbers that carry on from11913.3) I'm running in a shared environment - the server is hosted by awebhosting company (who shall remain nameless unless I can prove it's theirfault!) based in the US - the server has 100's of other Users databasesrunning on it.I just don't know where to begin diagnosing this sort of problem. But it hasme really running scared. It's not the first time something like this hashappened to me (i've noticed it once before when I had to get a connectionkilled by the people who manage our server because of a long-running querythat seemed to have just got bunged up and was locking a key table) - butthat was just a few records changed by the user who's connection got killed.Nothing like this... but it's pretty scary - I've got no way of knowing thatI'm losing changes like this on a continuous basis. It's my worstnightmare - like a pipe leaking underneath a floor board - and you only findout when the water starts running down the stairs!Has anyone got any ideas? Any starting places? Anyone else had anything likethis happen to them before?ThanksNick
Any sql script or powershell script which outputs late running jobs? Currently I am using the below script to find out currently running jobs along with duration. But my requirement is to add few more columns to the query which indicates whether jobs is running fine or running behind expected time.
-currently using query to pull running jobs SELECT ja.job_id, j.name AS job_name, ja.start_execution_date, ISNULL(last_executed_step_id,0)+1 AS currently_executing_step_id,
Hi all I have a form view which uses a SQL data source control to retrieve it's data from the sql express database the form view is used for view,edit,delete and insert data into the database in the insert mode I have two dropdownlists, where the second one is depending on the first one to retrieve the correct data from the data base BUT when selecting a value in the first dropdownlist it give me the following erro: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
Please How can do this any help is appriciated bye
Hey guys, Am in need of help please, basically the program im working with at the moment is when you add a New Contract, it will grab the Contract Number you have entered, Post it over to another page, then using that number bind a Gridview. The SQL being "SELECT Contract_ID, Contract_Number, Start_Date, End_Date, Quarterly_Rent FROM ECS_Contracts_Test WHERE Contract_Number = " & conNoVar (this being the Contract Number of the recently added Contract), however then it comes to Bind the Grid it kicks up an System.Data.SqlClient.SqlException: Syntax error converting the nvarchar value '2009P7899' to a column of data type int.But the Column Contract_Number is set to Varchar and all I really want to do is to create this gridview using this criteria and not convert anything! The Contract_ID is an int, which is needed as I increment it. Heres the error code: Public Sub BindtheGrid()'Bind the Contract Grid, where ContractID is used Dim SQL As String = "Contract_ID, Contract_Number, Start_Date, End_Date, Quarterly_Rent" Dim objConn As SqlConnection = New SqlConnection(ConnectionString) Dim cmdstock As SqlCommand = New SqlCommand("SELECT " & SQL & " FROM ECS_Contracts_Test WHERE Contract_Number = " & contractQueryID, objConn) cmdstock.CommandType = CommandType.Text objConn.Open() GridView1.DataSource = cmdstock.ExecuteReader() GridView1.DataBind() objConn.Close() End Sub If you need any more information then please let me know. Mucho Aprreciated
Hi guys, I am about to bind my websites user inputted values into my database. I intend to use sql for this. THe site is very basic, dropdownlists and textboxes. The user is required to choose values and write in questions. Now these inputs ought to be stored somewhere right??, so for that i am using sql. Now i know sql, but how do I store data from a website and all, I have no clue, someone give me basic steps on how to go about doing this pleaseeeeee!!!
I have this stored procedure that almost works: set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go
ALTER PROCEDURE [dbo].[udForumTopicMessageByForumTopicID] @ForumTopicID int AS SELECT ftm_parent.ForumTopicMessageID AS "ForumTopicMessageID", ftm_parent.ForumTopicID AS "ForumTopicID", ftm_parent.ContactID AS "ContactID", ftm_parent.MessageTitle AS "MessageTitle", ftm_parent.MessageText AS "MessageText", ftm_parent.ApprovedInd AS "Approved", ftm_parent.ReviewedInd AS "ReviewedInd", ftm_parent.ParentMessageID AS "ParentMessageID", ftm_parent.OwnerCompany AS "ForumTopicMessageOwnerCompany", ftm_parent.CreateUser AS "ForumTopicMessageCreateUser", ftm_parent.UpdateUser AS "ForumTopicMessageUpdateUser", ftm_parent.CreateDate AS "ForumTopicMessageCreateDate", ftm_parent.UpdateDate AS "ForumTopicMessageUpdateDate", '('+CAST(ChildResponseCount As VARCHAR(10))+')' As "ChildResponseCount", (T_Contact.Lastname + ', ' + T_Contact.Firstname) As "ContactName" FROM [T_ForumTopicMessage] as ftm_parent INNER JOIN [T_Contact] ON [T_Contact].ContactID = ftm_parent.ContactID Left JOIN (Select COUNT([T_ForumTopicMessage].ForumTopicMessageID) As "ChildResponseCount", MAX([T_ForumTopicMessage].ParentMessageID) AS "ParentMessageID" FROM [T_ForumTopicMessage] WHERE [T_ForumTopicMessage].ParentMessageID = ftm_parent.ForumTopicMessageID group by [T_ForumTopicMessage].ForumTopicMessageID) as ftm_child ON ftm_parent.ForumTopicMessageID = ftm_child.ParentMessageID WHERE ftm_parent.ForumTopicID = @ForumTopicID ORDER BY ftm_parent.CreateDate See the purple ftm_parent.ForumtopicMessageID. If I hard-code that to a 2, this works. With the fieldname there, SQL Server Management Studio says: Msg 4104, Level 16, State 1, Procedure udForumTopicMessageByForumTopicID, Line 9 The multi-part identifier "ftm_parent.ForumTopicMessageID" could not be bound. If any experts out there can help me out with this, I'm sure it wouldn't take much to fix.
i want to count the number of times a particular data occurs in a table and display that data in a listbox
initially i planned to count the number of occurrences and bind that number to a variable for further manipulation but i have no idea how to do the binding part
I am new to .net and I am using Visual Web Developer 2005 Express with SQL Server 2005 Express. What I would like to do is connect to my SQL database (which resides in the app_data folder) and open a table and pull out a field and place it in either a textbox or label on the page. No editing or deleting. Just simple one field binding. By the way, I can do this with all the cool built-in tools of VWD, but I want to know how to do it all by hand. I would really appreciate it if someone could help me out.
I have search for answers to the all over google and every thing I have found so far did not work for some reason or anothr. . Here is what I am looking for I am codeing in Visual Studio using C#. I have been able to crate a connection and create taxt boxes with a submit button that when it is presed enters data in to a database (Sql server) what I have been unable to do is: 1. Display data in a text box. 2. Update data 3. create buttons to navagate through fields. I know I can do this with the gridview or datagrid but in really need a custome form for what I am doing.
I am using C#.Net, Visual web Developer, SQL server 2000. I have a SQL query which I am binding it to a DataGrid. SQL : "SELECT ord_number, ord_ID, ord_split, ord_Name, ETD_Date, OSP_FSD FROM ORDERS" In My DataGrid I have a dynamic databound column. I am able to bind one column to this databound column using following code. BoundColumn ETDDate = new BoundColumn(); ETDDate.HeaderText = "ETD Date"; ETDDate.DataField = "OSP_FSD"; mygrid2.Columns.AddAt(ETDDate); but now I want to bind this databound column based on the following criteria to two different database columns. if(ord_split = 1) { ETDDate.DataField = "OSP_FSD"; } else { ETDDate.DataField = "ETD_Date"; } How to get value of ord_split before binding SQL to teh DataGrid? i.e I just want to take value of ord_split and not all the values of SQL. Please Help!
This is an easy question. I thought I have databinded a textbox to a SQLDataSource. But now I do not see how to do that now. Can somebody help with this? Thanks,
Hi, I wants to bind textbox with sqldatasource in c#.net so I am using following code and has following error... Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.Source Error:
Line 22: Line 23: System.Data.DataView dv = (DataView) SqlDataSource1.Select(System.Web.UI.DataSourceSelectArguments.Empty);Line 24: TextBox1.Text = dv[0]["Proid"].ToString();Line 25: Line 26: }Please, anybody knows solution tell me
Ok I have a script to generate a database, and newly added to the database is a date fild for a specfic table. I have the 'Default value or binding' set to (getdate()) how exactly would you add that to the script for then the table is initialy generated. Or is it soemthing I would need another script to do right after the table generation.This is the script for the table in question:CREATE TABLE [dbo].[cust_file] ( [id] [int] IDENTITY (1, 1) NOT NULL , [customer_id] [int] NULL , [filename] [varchar] (255) NULL , [filedata] [image] NULL , [contenttype] [varchar] (255) NULL , [length] [int] NULL, [added_date] [datetime] NULL) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]GO Any help would be great,Tim MeersWannabe developer.
I want to bind some data to a text box from sql server db. but when i run the page i get an error. here is my code. <form id="form1" runat="server"> <div> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:imacsConn %>" SelectCommand="SELECT Reportnumber FROM [SummaryBlue] WHERE REPORTNUMBER = @REPORTNUMBER"> <SelectParameters> <asp:QueryStringParameter Name="REPORTNUMBER" QueryStringField="REPORTNo" Type="String" />
Error: Exception Details: System.FormatException: Input string was not in a correct format.Source Error:
Line 25: </SelectParameters> Line 26: </asp:SqlDataSource> Line 27: <asp:TextBox ID="TextBox1" runat="server" Columns="<%$ ConnectionStrings:imacsConn %>"></asp:TextBox></div> Line 28: </form>
Hi i'm a new to ASP.NET and for some reason when i click the Next button in the code below, the pageIndex does not change. Please assist, Basically what i'm trying to do is to use DataAdapter.fill but passing in the start index and the number of records to pull from the dataset table. using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Data.OleDb; public partial class Home : System.Web.UI.Page { //ConnectionOleDbConnection dbConn; //discount that can be change by user using a gui interface //CurrentPageint pageIndex = 0;double discount = 0.15 ; protected void Page_Load(object sender, EventArgs e) { // homeGridView.Visible = true;
BindList();
}protected string getSpecial(string price,object sale) {String special = "";if (sale.ToString().CompareTo("True") == 0) {special = String.Format("{0:C}",double.Parse(price) * (1-discount)); }return special; } protected void BindList() { //Creating an object for the 'PagedDataSource' for holding the data.
//PagedDataSource objPage = new PagedDataSource(); try { //open connection openConnection(); //sql commandstring columns = "*"; string SqlCommand = "Select " + columns + " from Books"; //create adapters and DataSetOleDbDataAdapter myAdapter = new OleDbDataAdapter(SqlCommand, dbConn);DataSet ds = new DataSet("bSet");
//create tableDataTable dt = new DataTable("Books");myAdapter.Fill(ds, pageIndex, 9, "Books");
Response.Write("Page Index: "+pageIndex); //create table data viewDataView dv = new DataView(ds.Tables["bTable"]); booksDataList.DataSource = ds; booksDataList.DataBind();
Hi all, The Scenario: Database1:Table1(callingPartyNumber,originalCalledPartyNumber, finalCalledPartyNumber, DateTimeConnect, DateTimeDisconnect, Duration) Database2:Table2(Name,Number) Output in Gridview:
callingPartyNumber Name originalCalledPartyNumber finalcalledPartyNumber dateTimeConnected dateTimeDisconnected Duration (HH:MM:SS) I bind gridview programatically using DataTable and stored procedures. The data comes from a table (Table1) in a database (Database1) on SQL Server. The gridview displays fields callingPartyNumber, originalCalledPartyNumber, finalCalledPartyNumber, DateTimeConnect, DateTimeDisconnect and Duration in this order. All the columns in this gridview are databound columns. I have another table (Table2) in a seperate SQL Server database (Database2) but on the same server which maps the callingPartNumber value with the name attached with that number. Note that the field names in Table2 are different from the field names in Table1. Is it possible to display the Name field also in the gridview after the first field callingPartyNumber and then the other fields. Its like data coming from two tables into the gridview. Thanks
Hi all. I have a label on my page and I want to bind it to a field in a table. The catch is that I want to bind it to the last row in the table. I think I can use the custom binding, but I don't know how to bind to the last row. Any Suggestions ? p.s. The page is tied to an SqlDataSource that retrieves the data from the above table. Thanks in advance.
Hi, I am using a SQL DataSource with a few parameters. I need to specify the value of the parameters at run time but I need a custom way to do it as the value needs to be calculated not come from Cookie, Control, Form, Profile, QueryString or Session. Is there a way to bind your own value to these parameters. For instance if I had a variable how would I bind that to the parameter? At the moment i am doing the following which works but I dont think it is the correct way dsMyDataSource.SelectParameters["MyParameter"].DefaultValue = MyCalculatedValue; In previous projects i have added a value to the Session and then bound the parameter value to the session but that doesnt seem like a good solution either. Thanks for any help you can give. Martin
Hi All I am new to VS 2005 and ASP.NET. I used to use Dreamweaver to design but now I am trying VS. What I want to do is to display data retrieved with a SqlDataSource in a web page. I know how to do it by binding it to the various controls (Grid, DataList, DetailsView, FormView, Repeater.) available but how can I display it without using any of the mentioned (Grid, DataList, DetailsView, FormView, Repeater)? Any help apprecited.