set ANSI_NULLS ONset QUOTED_IDENTIFIER ONGOALTER
procedure [dbo]
as
declare @uid nchar(
declare @pwd nchar(
declare @state bit;
set @state=
if( @user_sort=
begin
declare cursor_temp cursor local for
select 學號
open cursor_temp;
fetch cursor_temp into @uid
close cursor_temp;
end
if( @uid =@userID and @pwd=@userPWD )
begin
set @state=
return @state;
end;
else
begin
set @state=
return @state;
end;
C#代碼如下
using System;
using System
using System
using System
using System
namespace 密碼驗證
{
class security
{
public static DataSet check(string uid)
{
SqlConnection mySqlConnection = new SqlConnection(
mySqlConnection
SqlCommand mySqlCommand = mySqlConnection
mySqlCommand
SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter();
DataSet myDataSet = new DataSet() ;
mySqlDataAdapter
mySqlDataAdapter
mySqlConnection
return myDataSet;
}
public static bool secuirty_check(int user_select
{
int result =
SqlConnection mySqlConnection = new SqlConnection(
SqlCommand mySqlCommand = new SqlCommand(
mySqlCommand
//
SqlParameter param = new SqlParameter();
param
mySqlCommand
//
mySqlCommand
mySqlCommand
mySqlCommand
//mySqlCommand
mySqlConnection
mySqlCommand
mySqlConnection
if ( result ==
return false;
else
return true;
}
}
class Program
{
static void Main(string[] args)
{
/*
string uid;
Console
uid=Console
DataSet myDataSet = security
foreach (DataRow thisDataRow in myDataSet
{
Console
Console
Console
}
*/
string uid;
string pwd;
Console
uid = Console
Console
pwd = Console
if (security
Console
else
Console
Console
}
}
}
From:http://tw.wingwit.com/Article/program/net/201311/12756.html