|
Why didn't you use the "Modify" button rather than create a new post?
|
|
|
|
|
Try this.
select * from property
where
substring(func_key,1,5) = 'GEOSS'
And substring(func_key,6,8)>= 3 and
substring(func_key,9,16)='PV000000'
And substring(Attrib_code,5,2)=16
Regards,
Arun Kumar.A
|
|
|
|
|
I need to Find All the Records that Are GEOSS and that are not DUETt.The Following statement made that Possible.
select * from property
where substring(func_key,1,5) = 'GEOSS' And substring(func_key,6,8)>= 3
*There is a Column that is named lis_key in the above results i need to select it from the results above results distictively and search based on that Distict lis_key to Find al records that have
Func_key column ='PV000000' and substring(Attrib_code,5,2)!=16
Please Help ,i hope i explained it clear today
Vuyiswa
|
|
|
|
|
Try this.
select * from property where lis_key in
(select lis_key from property
where substring(func_key,1,5) = 'GEOSS' And substring(func_key,6,8)>= 3)
and Func_key column ='PV000000' and substring(Attrib_code,5,2)!=16
If U want something other than this, provide sample data of around 5
rows (for the required columns alone), and the output result U want.
Regards,
Arun Kumar.A
|
|
|
|
|
OOH GOd you are Good, but i need you to make th results to be Distinct based on Lis_key,If you could just add distinct in that Query.
Thanks a lot again.
You are Good
Vuyiswa
|
|
|
|
|
hi thank you a lot , am noting you Sir, please attend to next Problem.
I NEED TO UPDATE THESES RECORDS BASED ON THIS QUERY
select * from property where
Lis_key in(select lis_key from property where substring(func_key,1,5)='GEOSS'
And substring(func_key,6,8) >=3)and
Func_key = 'PV000000'
and substring(Attrib_code,5,2)!=16
AND ACTIVE = 1
order by Lis_key
HELP ME
Vuyiswa
|
|
|
|
|
Do U want to update a column which satisfy these conditions?
If so,
We can do that by using a simple update statement:
update property set columnName=value where
Lis_key in(select lis_key from property where substring(func_key,1,5)='GEOSS'
And substring(func_key,6,8) >=3)and
Func_key = 'PV000000'
and substring(Attrib_code,5,2)!=16
AND ACTIVE = 1
order by Lis_key
Regards,
Arun Kumar.A
|
|
|
|
|
The Following is the update i want to do, con you combine these from what you gave me previously.
but it gives me an Error
"Server: Msg 170, Level 15, State 1, Line 2
Line 2: Incorrect syntax near '('.
"
update property
set substring(Attrib_code,5,2)=16
where Exists (select * from property where
Lis_key in(select lis_key from property where substring(func_key,1,5)='GEOSS'
And substring(func_key,6,8) >=3)and
Func_key = 'PV000000'
and substring(Attrib_code,5,2)!=16
AND ACTIVE = 1
)
Vuyiswa
|
|
|
|
|
Haw can U assign to the value returned by the substring function?
Try this:
update property
set Attrib_code=substring(Attrib_code,0,5)+'16'+substring(Attrib_code,7,n)
where Lis_key in(select lis_key from property where substring(func_key,1,5)='GEOSS'
And substring(func_key,6,8) >=3)and
Func_key = 'PV000000'
and substring(Attrib_code,5,2)!=16
AND ACTIVE = 1
)
"n" must be the lenght of characters after 16.
Note:Before testing, make sure U have backup of the table.
Regards,
Arun Kumar.A
|
|
|
|
|
hi Arun thakns again Can yo Please explain these line of code to me, why this Positions in substring
update property
set Attrib_code=substring(Attrib_code,0,5)+'16'+substring(Attrib_code,7,n)
Vuyiswa
|
|
|
|
|
Hi,
set Attrib_code=substring(Attrib_code,0,5)+'16'+substring(Attrib_code,7,n)
Let Attrib_code ='abcde10xyz'
U R trying to change the numbet 10 to 16.
substring(Attrib_code,0,5) will return 'abcde'
substring(Attrib_code,7,3) will return 'xyz'
so 'abcde'+'16'+'xyz' will evaluate to 'abcde16xyz'.
Have I given the right update command?
Regards,
Arun Kumar.A
|
|
|
|
|
Thank you Sir Arun.Immanuel you have given me the right update command, my table is looking good.AM taking note of you.
Kind regards
Vuyiswa Maseko
vuyiswam@Tshwane.gov.za
South Africa
Vuyiswa
|
|
|
|
|
Welcome.
Regards,
Arun Kumar.A
|
|
|
|
|
i have a Query that is workng well
select * from property
where
substring(func_key,1,5) = 'GEOSS' And substring(func_key,6,8)>= 3
it Display all the records that has 'GEOSS' and has a functional key that is equal to 3 and greater than 3. the Query is working.
NB:* The 'GEOSS' Records are Subtyptes of PVOOOOOO Records. It means that the main Key will be like '022100550.PV000000' and the Subtypes will be
'022100550.GEOSS001
'022100550.GEOSS002
'022100550.GEOSS003
Those are subtypes of 022100550.PV000000. above SQL statement searches them and Exclude the main key, i need a separate key that will show all main keys of the subkeys. that means all the PV000000 that has Sub keys GEOSS.
Please Help
where the
Vuyiswa Maseko Junior Programmer that will never stop learning form Code Project
|
|
|
|
|
Why don't you break all this information in to separate columns? At the moment it looks like it is breaking the first normal form (Keep separate data in separate columns). Wouldn't it make it much easier and more efficient to query?
|
|
|
|
|
This is a large Database that holds the propery of whole Province, i was built i can create my own fields i have to search for what they want and Fix what they want.
Vuyiswa
|
|
|
|
|
Can you rephrase that. I didn't understand it.
|
|
|
|
|
I have created the login page of my project,I want create a stored procedure in SQL 2005for the user login page how to compare the two text boxes, please any body help me with the stored procedure and how to call the that stored procedure from server page in c#.
Thank you
Bilal Ahmed Wani.
Software Traniee.
|
|
|
|
|
Bilal wani wrote: how to compare the two text boxes
That is not a function of SQL Server. That is a function of your application.
Bilal wani wrote: please any body help me with the stored procedure and how to call the that stored procedure from server page in c
If you are asking that level of question then perhaps a tutorial on accessing SQL Server from a .NET application would be more useful to you. Search results[^]
|
|
|
|
|
Dear Friend ,
I have created the login page, you just go through the code of that page below:
Client End:(ASP.NET 2005)
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login" %>
<title>Metalearn Login Page
// <!CDATA[
// ]]>
<asp:panel id="Panel1" runat="server" backcolor="MidnightBlue" height="236px" style="z-index: 100;
left: 429px; position: absolute; top: 176px; border-left-style:inset; border-bottom-color:Aqua; border-right-color:Aqua" width="425px" forecolor="Aqua">
<asp:label id="Label2" runat="server" height="23px" style="z-index: 100; left: 36px;
position: absolute; top: 53px" text="User Name" width="129px">
<asp:button id="Button2" runat="server" style="z-index: 101; left: 183px; position: absolute;
top: 160px" text="Sign In" validationgroup="SignIn" onclick="Button2_Click" backcolor="CornflowerBlue" bordercolor="CornflowerBlue" width="77px">
<asp:label id="Label3" runat="server" height="25px" style="z-index: 102; left: 35px;
position: absolute; top: 111px" text="Password" width="96px">
<asp:textbox id="txtuname" runat="server" style="z-index: 103; left: 210px; position: absolute;
top: 55px" backcolor="Beige" validationgroup="SignIn">
<asp:textbox id="passwrd" runat="server" style="z-index: 104; left: 211px; position: absolute;
top: 108px" textmode="Password" width="149px" backcolor="LightGoldenrodYellow" validationgroup="SignIn">
<asp:requiredfieldvalidator id="RequiredFieldValidator2" errormessage="* Please enter your Password" controltovalidate="TextBox1" validationgroup="SignIn" runat="server" style="z-index: 105; left: 209px; position: absolute; top: 137px" font-size="XX-Small" width="187px">
<asp:button id="Button1" runat="server" validationgroup="SignIn" style="z-index: 106; left: 270px; position: absolute;
top: 159px" text="Reset" onclick="Button1_Click" backcolor="CornflowerBlue" bordercolor="CornflowerBlue" width="104px">
<asp:requiredfieldvalidator id="RequiredFieldValidator1" errormessage="* Please enter your User Name" controltovalidate="TextBox1" validationgroup="SignIn" runat="server" style="z-index: 107; left: 208px; position: absolute; top: 84px" font-size="XX-Small" width="201px">
<asp:label id="Label1" runat="server" height="19px" style="z-index: 101; left: 460px;
position: absolute; top: 194px" text=" Login In Here" width="247px" forecolor="Cyan">
<asp:panel id="Panel2" runat="server" backcolor="White" forecolor="MintCream"
="" height="428px" style="z-index: 99; left: 146px; position: absolute; top: 81px; border-style:outset;
border-bottom-color:Lime; border-left-color:Lime; border-right-color:Lime; border-top-color:Lime" width="742px">
<asp:label id="lblerrormsg" runat="server" forecolor="Red" style="z-index: 101; left: 310px;
position: absolute; top: 346px" width="282px">
Server end:(C#)
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.SqlClient;
using Banking.Encryption;
public partial class Login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// Put user code to initialize the page here //info.dll DATA =G5HQ4RcM3shUNn5uaYHTztba/UuiBuDG
}
protected void Button2_Click(object sender, EventArgs e)
{
EncryptDecrypt objEncrypt = new EncryptDecrypt();
if (txtuname.Text = "bank" & passwrd.Text = "bn")
{
Response.Redirect("Mainmenu.aspx", false);
}
else
{
lblerrormsg.Text = "Invalid Login";
//Button2.Attributes.Add("onclick", "return validations();");
txtuname.Text = "";
passwrd.Text = "";
txtuname.Focus();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
lblerrormsg.Text = "";
txtuname.Text = "";
passwrd.Text = "";
txtuname.Focus();
}
}
Now the thing I have created a database table in SQL which can store userlogins now I want to know how to write the code in c# which can verify userlogins how to pass the parameters to compare user logins.
Thanks
Bilal
|
|
|
|
|
I think youre a genuine beginner at this stage. What you need to do here is to access the database from ur application and in this code sample here there is no sign of any DataAdapter or a query used.
First get some knowledge abt the DataSets, TableAdapters, ADO .NET and DataAdapters,
you could do it like this.
string sql =@"Select UserName From UsersTable Where UserName LIKE '"+textBoxUserName.Text+"' AND Password = '"+textBoxpass.Text+"';
//(Caution: password is case insensitive in this case. Convert it to Varbinary for making it case sensitve)
SqlCommand cmd = new SqlCommand(sql, sqlConnection1);
if(cmd.ExecuteNonQuery() == 1)
{
// login successful
}
else
{
login failed
}
Its always a better idea not to store the actual text for passwords in Db. Its better to use an encoding scheme. But for now, u have a long road ahead of u
|
|
|
|
|
Thanks for your help I will try.
Bye!
|
|
|
|
|
Dearfriend I changed the coding as u told me...
plz make the correction of the below code..
protected void Button2_Click(object sender, EventArgs e)
{
string sql =@"Select [Username],[Password] From [Login] Where UserName = '"+Textbox1.Text+"' AND Password ='"+Textbox2.Text+"'";
SqlConnection con = new SqlConnection("Data Source=BILAL\\SQLEXPRESS;Initial Catalog=Customers;Integrated Security=True");
SqlCommand cmd = new SqlCommand(sql, con);
//cmd.Parameters.AddWithValue("@Username", Textbox1.Text);
//cmd.Parameters.AddWithValue("@Password", Textbox2.Text);
con.Open();
//cmd.ExecuteNonQuery();
if(cmd.ExecuteNonQuery()==0)
{
// login successful
Response.Redirect("Mainmenu.aspx", false);
}
else
{
lblerrormsg.Text = "Invalid Login";
//Button2.Attributes.Add("onclick", "return validations();");
Textbox1.Text = "";
Textbox2.Text = "";
Textbox1.Focus();
}
con.Close();
}
I have done Insertion Deletion Updation but I am not able to create the logic for to compare the input with a sql table , please modify the coding completely
thank You.
With Regards
Bilal
-- modified at 1:42 Thursday 26th April, 2007
|
|
|
|
|
Hi.
I'm writing an application able to work with Access, MS SQL Server 2005 or MySql database, depending on the user's will.
I want to use the classes of the System.Data.OleDb namespace for all three providers.
It's working with Access so for and now I'm trying to use the other two.
What connection strings must be specified for MySql and MS SQL 2005?
(Remote connection must be possible).
Thanks.
|
|
|
|
|
|